Skip to content

Instantly share code, notes, and snippets.

@simonrenoult
Last active April 28, 2017 08:47
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 simonrenoult/8a598e8fb9bafb90540b0456db23e3a6 to your computer and use it in GitHub Desktop.
Save simonrenoult/8a598e8fb9bafb90540b0456db23e3a6 to your computer and use it in GitHub Desktop.
hapi dependency injection
const Hapi = require('hapi')
function createServer({conf, controllers}) {
const server = new Hapi.Server()
server.connection(conf)
app.routes([
{
method: 'GET',
path: '/users',
handler (request, reply) {
reply(controllers.users.findAll())
}
}
])
return server
}
module.exports = createrServer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment