Initial commit: installable PWA hello world

React + TypeScript + Tailwind v4 + shadcn/ui frontend (client), Express +
better-sqlite3 backend (server) in a pnpm workspace. Includes vite-plugin-pwa
manifest, service worker, and iOS install meta tags. GET /api/hello increments a
visit counter in SQLite; backend serves the built client in production.
This commit is contained in:
2026-08-03 22:45:19 +02:00
commit 3785d08e97
38 changed files with 8405 additions and 0 deletions

32
server/src/index.ts Normal file
View File

@@ -0,0 +1,32 @@
import express from "express"
import fs from "node:fs"
import path from "node:path"
import { fileURLToPath } from "node:url"
import { helloRouter } from "./routes/hello.js"
const __dirname = path.dirname(fileURLToPath(import.meta.url))
const app = express()
const PORT = process.env.PORT ? Number(process.env.PORT) : 3001
app.use(express.json())
app.get("/api/health", (_req, res) => {
res.json({ ok: true })
})
app.use("/api", helloRouter)
// In production, serve the built client (client/dist) and fall back to index.html.
const clientDist = path.resolve(__dirname, "../../client/dist")
if (fs.existsSync(clientDist)) {
app.use(express.static(clientDist))
app.get("*", (_req, res) => {
res.sendFile(path.join(clientDist, "index.html"))
})
}
app.listen(PORT, () => {
console.log(`Pocket Pascal server listening on http://localhost:${PORT}`)
})