19 lines
370 B
JavaScript
19 lines
370 B
JavaScript
// 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, '0.0.0.0')
|
|
} catch (err) {
|
|
fastify.log.error(err)
|
|
process.exit(1)
|
|
}
|
|
}
|
|
start()
|