Last active
April 28, 2017 08:47
-
-
Save simonrenoult/8a598e8fb9bafb90540b0456db23e3a6 to your computer and use it in GitHub Desktop.
hapi dependency injection
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
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