Closed stephengardner closed 9 years ago
@stephengardner just using "promise" for packagepath should work. non relative paths are handled by https://github.com/c9/architect/blob/master/architect.js#L191
Got it, somehow that's not working. Right now I'm requiring the npm modules in the architect modules themselves.
This doesn't work for me.
//...
var appConfig = [
{
packagePath : './app',
config : config
},
{
packagePath: "promise"
},
"./plugins/connections"
];
var tree = architect.resolveConfig(appConfig, __dirname);
architect.createApp(tree, function(err, Architect){
if(err) {
logger.error(err);
}
else {
onCreateApp(Architect);
}
});
//...
I get TypeError: not a function from within node_modules/promise/lib/core.js
That means promise isn't an architect plugin (doesn't provide like https://github.com/c9/architect/blob/master/demos/calculator/plugins/auth/auth.js#L1) in that case just use require("promise") directly
Got it, alright that's how I'm doing it, wasn't sure if that was the correct way, I guess it makes sense. The variations in all these DI frameworks made it a little confusing. Thanks
If I want to inject, for example, the
promise
npm module. How is this achieved? Forgive me if this is an obvious question, I've watched the YouTube video and read the documentation to no avail. Just getting my feet wet with different DI in Node