this._init is not a function
delvedor opened this issue · 3 comments
delvedor commented
Hi, I get this error while trying to use boot-in-the-arse
.
What am I doing wrong?
Here the code.
Error:
.../node_modules/boot-in-the-arse/boot.js:119
this._init()
^
TypeError: this._init is not a function
at Function.Boot.use (.../node_modules/boot-in-the-arse/boot.js:119:8)
at Object.<anonymous> (.../example.js:27:9)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.runMain (module.js:590:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
mcollina commented
Try removing fastify.use = boot.use
completely :)
delvedor commented
Here's how is the function:
function build () {
const router = wayfarer('/404')
const map = new Map()
bootInTheArse(fastify)
router.on('/404', defaultRoute)
// shorthand methods
fastify.get = get
fastify.post = post
fastify.put = put
// extended route
fastify.route = route
return fastify
function fastify (req, res) {
router(stripUrl(req.url), req, res)
}
And here's the error:
.../example.js:27
fastify.use(require('./plugin'), {}, console.log)
^
TypeError: fastify.use is not a function
at Object.<anonymous> (.../example.js:27:9)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.runMain (module.js:590:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
delvedor commented
Problem solved, for the records, it was missing a '{}'
:
bootInTheArse(fastify, {})