Skip to content

Instantly share code, notes, and snippets.

@annibuliful
Created March 8, 2018 04:29
Show Gist options
  • Save annibuliful/6587c85665afa5364324c9d4c967eaa3 to your computer and use it in GitHub Desktop.
Save annibuliful/6587c85665afa5364324c9d4c967eaa3 to your computer and use it in GitHub Desktop.
const fastify = require('fastify')()
// Declare a route
fastify.get('/', async (request, reply) => {
return { hello: 'world' }
})
// Run the server!
const start = async () => {
try {
await fastify.listen(3000)
fastify.log.info(`server listening on ${fastify.server.address().port}`)
} catch (err) {
fastify.log.error(err)
process.exit(1)
}
}
start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment