initialisation de Fastify
This commit is contained in:
2078
package-lock.json
generated
Normal file
2078
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
17
package.json
17
package.json
@@ -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
9
src/app.ts
Normal 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
13
src/server.ts
Normal 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
11
tsconfig.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2020",
|
||||
"module": "CommonJS",
|
||||
"rootDir": "./src",
|
||||
"outDir": "./dist",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user