added server, db, auth system

This commit is contained in:
polwex 2026-04-06 22:11:34 +09:00
parent 4d3395fa1c
commit 199dab69f9
28 changed files with 989 additions and 192 deletions

34
server.ts Normal file
View file

@ -0,0 +1,34 @@
import { serve } from "bun"
import { initDb } from "./server/db"
import {
registerOptions,
registerVerify,
loginOptions,
loginVerify,
me,
logout,
} from "./server/auth"
import index from "./index.html"
await initDb()
const server = serve({
port: 5174,
routes: {
"/*": index,
"/api/auth/register/options": { POST: registerOptions },
"/api/auth/register/verify": { POST: registerVerify },
"/api/auth/login/options": { POST: loginOptions },
"/api/auth/login/verify": { POST: loginVerify },
"/api/auth/me": { GET: me },
"/api/auth/logout": { POST: logout },
},
development: {
hmr: true,
console: true,
},
})
console.log(`Server running on ${server.url}`)