Skip to content

Instantly share code, notes, and snippets.

@antony
Created February 11, 2018 21:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antony/11b028fc1ff39f63be64824f9642eac8 to your computer and use it in GitHub Desktop.
Save antony/11b028fc1ff39f63be64824f9642eac8 to your computer and use it in GitHub Desktop.
Seed hapijs v17 application.
'use strict'
const Hapi = require('hapi')
const server = Hapi.server({ port: 3000, host: 'localhost' })
const init = async () => {
await server.start()
console.log(`Server running at: ${server.info.uri}`)
}
init().catch((err) => {
console.log(err)
process.exit(1)
})
server.route({
method: 'GET',
path: '/{name}',
handler: (request, h) => {
return 'Hello, world!'
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment