v0.1.8 - 백엔드 초안 추가

This commit is contained in:
2026-04-21 17:48:34 +09:00
parent 7ff8bd06b1
commit d5aa7f8153
13 changed files with 2482 additions and 7 deletions

46
backend/src/server.js Normal file
View File

@@ -0,0 +1,46 @@
import Fastify from 'fastify'
import cors from '@fastify/cors'
import { env } from './config.js'
import { sqlite } from './db/client.js'
const app = Fastify({
logger: true,
})
await app.register(cors, {
origin: env.CORS_ORIGIN,
credentials: true,
})
app.get('/health', async () => {
const version = sqlite.prepare('select sqlite_version() as version').get()
return {
status: 'ok',
service: 'ten-minute-planner-backend',
database: {
client: 'sqlite',
version: version?.version ?? 'unknown',
},
}
})
app.get('/api/meta', async () => ({
auth: 'planned',
storage: 'sqlite',
orm: 'drizzle',
notes: [
'회원가입 및 로그인 API는 다음 단계에서 추가 예정',
'플래너 저장 API는 로컬 저장 레이어 분리 이후 연결 예정',
],
}))
try {
await app.listen({
port: env.PORT,
host: '0.0.0.0',
})
} catch (error) {
app.log.error(error)
process.exit(1)
}