Mise en place du serveur de base

This commit is contained in:
2026-03-26 20:51:00 +01:00
parent 135f910c62
commit 45431a523a
2 changed files with 28 additions and 0 deletions

13
src/core/app.ts Normal file
View File

@@ -0,0 +1,13 @@
import Fastify from 'fastify'
export async function buildApp() {
const app = Fastify({
logger: true
})
app.get('/', async () => {
return { status: 'ok' }
})
return app
}

15
src/core/server.ts Normal file
View File

@@ -0,0 +1,15 @@
import { buildApp } from './app'
const start = async () => {
const app = await buildApp()
try {
await app.listen({ port: 1234, host: '0.0.0.0' })
console.log('Server running on http://localhost:1234')
} catch (err) {
app.log.error(err)
process.exit(1)
}
}
start()