Created
March 8, 2018 04:29
-
-
Save annibuliful/6587c85665afa5364324c9d4c967eaa3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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