12
This commit is contained in:
1 parent
62bdd6291e
commit
2d4eee2950
81 files changed
-10766
No files matched your search
@@ -1,34 +0,0 @@
|
||||
import Fastify from 'fastify'
|
||||
import cors from '@fastify/cors'
|
||||
import multipart from '@fastify/multipart'
|
||||
import { config } from './config.js'
|
||||
import { authRoutes } from './routes/auth.js'
|
||||
import { cisesRoutes } from './routes/cises.js'
|
||||
import { updRoutes } from './routes/upd.js'
|
||||
import { plansRoutes } from './routes/plans.js'
|
||||
|
||||
const app = Fastify({ logger: true })
|
||||
|
||||
await app.register(cors, { origin: config.corsOrigin })
|
||||
await app.register(multipart, {
|
||||
limits: {
|
||||
fileSize: 10 * 1024 * 1024,
|
||||
files: 1,
|
||||
},
|
||||
throwFileSizeLimit: true,
|
||||
})
|
||||
|
||||
await app.register(authRoutes)
|
||||
await app.register(cisesRoutes)
|
||||
await app.register(updRoutes)
|
||||
await app.register(plansRoutes)
|
||||
|
||||
app.get('/health', async () => ({ status: 'ok', timestamp: new Date().toISOString() }))
|
||||
|
||||
try {
|
||||
await app.listen({ port: config.port, host: config.host })
|
||||
console.log(`Server running on http://${config.host}:${config.port}`)
|
||||
} catch (err) {
|
||||
app.log.error(err)
|
||||
process.exit(1)
|
||||
}
|
||||
Reference in new issue
Block a user