initialisation de Fastify

This commit is contained in:
2026-03-27 17:49:51 +01:00
parent b60d656978
commit d79ba35e1d
5 changed files with 2126 additions and 2 deletions

2078
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -4,12 +4,25 @@
"description": "BO pour la liste application",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "ts-node src/server.ts",
"build": "tsc",
"start": "node dist/server.js"
},
"repository": {
"type": "git",
"url": "bo_liste"
},
"author": "Raffi",
"license": "ISC"
"license": "ISC",
"dependencies": {
"@prisma/client": "^7.6.0",
"fastify": "^5.8.4"
},
"devDependencies": {
"@types/node": "^25.5.0",
"prisma": "^7.6.0",
"ts-node": "^10.9.2",
"typescript": "^6.0.2"
}
}

9
src/app.ts Normal file
View File

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

13
src/server.ts Normal file
View File

@@ -0,0 +1,13 @@
import app from './app'
const start = async () => {
try {
await app.listen({ port: 1234, host: '0.0.0.0' })
} catch (err) {
app.log.error(err)
process.exit(1)
}
}
start()

11
tsconfig.json Normal file
View File

@@ -0,0 +1,11 @@
{
"compilerOptions": {
"target": "ES2020",
"module": "CommonJS",
"rootDir": "./src",
"outDir": "./dist",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true
}
}