Add persistent user and session storage, protected profile requests, and React sign-in controls. Capture and preserve each user's timezone, and load development and production configuration before migrations and server startup.
23 lines
541 B
TypeScript
23 lines
541 B
TypeScript
import { db } from "./db";
|
|
import { createApi } from "./api";
|
|
import { readAuthConfig } from "./auth/config";
|
|
import index from "./index.html";
|
|
|
|
const app = createApi(db, readAuthConfig());
|
|
|
|
const server = Bun.serve({
|
|
hostname: "127.0.0.1",
|
|
port: Number(process.env.PORT ?? 3000),
|
|
routes: {
|
|
"/api": req => app.fetch(req),
|
|
"/api/*": req => app.fetch(req),
|
|
"/*": index,
|
|
},
|
|
development: process.env.NODE_ENV !== "production" && {
|
|
hmr: true,
|
|
console: true,
|
|
},
|
|
});
|
|
|
|
console.log(`Server running at ${server.url}`);
|