This commit is contained in:
7
Fastify/Dockerfile
Normal file
7
Fastify/Dockerfile
Normal file
@ -0,0 +1,7 @@
|
||||
FROM node:17-alpine
|
||||
|
||||
RUN npm install fastify
|
||||
|
||||
COPY . .
|
||||
|
||||
CMD ["node", "server.js"]
|
18
Fastify/server.js
Normal file
18
Fastify/server.js
Normal file
@ -0,0 +1,18 @@
|
||||
// Require the framework and instantiate it
|
||||
const fastify = require('fastify')({ logger: true })
|
||||
|
||||
// Declare a route
|
||||
fastify.get('/', async (request, reply) => {
|
||||
return { hello: 'world' }
|
||||
})
|
||||
|
||||
// Run the server!
|
||||
const start = async () => {
|
||||
try {
|
||||
await fastify.listen(3001)
|
||||
} catch (err) {
|
||||
fastify.log.error(err)
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
start()
|
Reference in New Issue
Block a user