Last active
March 13, 2016 16:32
-
-
Save jhyland87/298fc78cc9d068cb8ba1 to your computer and use it in GitHub Desktop.
HapiJS Custom plugin error
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
// 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