Skip to content

Instantly share code, notes, and snippets.

@jhyland87
Last active March 13, 2016 16:32
Show Gist options
  • Save jhyland87/298fc78cc9d068cb8ba1 to your computer and use it in GitHub Desktop.
Save jhyland87/298fc78cc9d068cb8ba1 to your computer and use it in GitHub Desktop.
HapiJS Custom plugin error
// File: real-plugin-src.js
module.exports = ( plugin, options, next ) => {
// Do stuff...
next()
}
module.exports.attributes = {
pkg: {
name: "test-plugin",
version: "1.0.0"
}
}
// File: ./test-plugin.js
module.exports = require('./real-plugin-src')
// File: ./app.js
const internals = {
manifest: {
connections: [{
port: 8000,
labels: ['api']
}],
registrations: [{
plugin: {
register: 'blipp',
options: {
showStart: true
}
}
}, {
plugin: {
register: './test-plugin',
options: {
rootResource: 'root',
routeDir: './dist/routes2'
}
}
}]
}
}
Glue.compose( internals.manifest, { relativeTo: __dirname }, ( err, server ) => {
if( err )
return console.error('# ERROR:', err )
server.start( () => console.log( '# Server Started: ', server.info.uri ))
})
/*
Error: Invalid plugin options {
"options": {
"rootResource": "root",
"routeDir": "./dist/routes2"
},
"register" [1]: {}
}
[1] "register" must be a Function
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment