Open pragya-olx opened 7 years ago
Please give more details about the issue. How are you trying to use electrolyte etc. with specific code samples.
When I try to run the examples given in the repo I get
electrolyte deprecated Container#node: Use Container#dir instead etc/init/00_ioc.js:20:15 .get() requires callback functions but got a [object Object] Error: .get() requires callback functions but got a [object Object] at /home/olx-pragya/electrolyte-examples/express/node_modules/express/lib/router/index.js:306:11 at Array.forEach (native) at Router.route (/home/olx-pragya/electrolyte-examples/express/node_modules/express/lib/router/index.js:302:13) at Router.(anonymous function) [as get] (/home/olx-pragya/electrolyte-examples/express/node_modules/express/lib/router/index.js:333:16) at Function.app.(anonymous function) [as get] (/home/olx-pragya/electrolyte-examples/express/node_modules/express/lib/application.js:467:26) at Function.routes (/home/olx-pragya/electrolyte-examples/express/app/routes.js:16:8) at routes (/home/olx-pragya/electrolyte-examples/express/node_modules/bootable/lib/phases/routes.js:43:21) at next (/home/olx-pragya/electrolyte-examples/express/node_modules/bootable/lib/initializer.js:43:9) at next (/home/olx-pragya/electrolyte-examples/express/node_modules/bootable/lib/phases/initializers.js:53:27) at next (/home/olx-pragya/electrolyte-examples/express/node_modules/bootable/lib/phases/initializers.js:69:15)
npm ERR! Linux 3.19.1-031901-lowlatency
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! node v6.9.5
npm ERR! npm v4.3.0
npm ERR! code ELIFECYCLE
npm ERR! errno 255
npm ERR! express-example@0.0.0 start: node bin/server.js
npm ERR! Exit status 255
npm ERR!
npm ERR! Failed at the express-example@0.0.0 start script 'node bin/server.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the express-example package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node bin/server.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs express-example
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls express-example
npm ERR! There is likely additional logging output above.
I fixed routes.js with
this.get('/', function(){ IoC.create('handlers/list'); }); this.post('/todo',function(){ IoC.create('handlers/create'); });
but now I am not getting any response.
This is because the IoC.create()
function returns a Promise. The Electrolyte documentation is a bit outdated.
You could try the following:
IoC
.create('handlers/list')
.then((handler) => {
this.get('/', handler);
});
NB: I didn't test this code, so it might not work as is.
@pragya-olx Did you find any fix for this issue?
.get() requires callback functions but got a [object Object] Error: .get() requires callback functions but got a [object Object]