Created
March 20, 2014 11:01
-
-
Save RyanHirsch/9661403 to your computer and use it in GitHub Desktop.
Hapi Pack through code or through Composer
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
| { | |
| "servers": [ | |
| { | |
| "port" : 8000, | |
| "labels": ["public"] | |
| } | |
| ], | |
| "plugins": { | |
| "capi-web": { } | |
| } | |
| } |
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
| var Hapi = require('hapi'); | |
| var pack = new Hapi.Pack(); | |
| pack.server(8000, { labels: ['public'] }); | |
| pack.require('capi-web', {}, function(err) { | |
| }); | |
| pack.start(function () { | |
| console.log('All servers started'); | |
| }); |
Author
The labels need to be in options, like:
"servers": [
{
"port": 8000,
"options": {
"labels": ['public']
}
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Comparison between creating a pack though code or using a config.json to let the hapi CLI create the necessary packs. My index.js works as expected, but the config.json with composer does not work. Not working, meaning it starts up, but none of the routes provided by
capi-webwork, just get 404 for all routes.