Last active
May 27, 2020 16:30
-
-
Save PierBover/ec87144fafa9b4ee65c1937e13364de1 to your computer and use it in GitHub Desktop.
This file contains 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
// init | |
const fastify = require('fastify')({ | |
ignoreTrailingSlash: true, | |
logger: true | |
}); | |
fastify.route({ | |
method: 'GET', | |
url: '/', | |
handler: (request, reply) => { | |
reply.header('Content-Type', 'text/html'); | |
reply.send('Hello Fastify!'); | |
} | |
}); | |
fastify.listen(process.env.PORT || 3000, '::', function (err, address) { | |
if (err) { | |
fastify.log.error(err) | |
process.exit(1) | |
} | |
fastify.log.info(`server listening on ${address}`) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment