zazoomauro / node-dependency-injection-express-middleware Goto Github PK
View Code? Open in Web Editor NEWA Node Dependency Injection middleware for Express
License: MIT License
A Node Dependency Injection middleware for Express
License: MIT License
import NDI from 'node-dependency-injection-express-middleware';
const options = ...
const ndi = new NDI(options)
const container = ndi.container
app.use(ndi.middleware)
I'm trying to use require instead of import and I struggle with it. I'm also pretty new to node.js
#app.js
const Express = require('express');
const app = Express();
const NDIMiddleware = require('node-dependency-injection-express-middleware');
const services = {serviceFilePath: './resources/services.yml'}
And I don't know where to go from here without throwing any errors like in those examples
#app.js
app.use(new NDIMiddleware.default(services).middleware());
#services.yml
services:
mailHandler:
class: './src/MailHandler'
#/src/MailHandler.js
class MailHandler {
constructor() {}
}
module.exports = MailHandler;
> [email protected] start /home/paul/GIT/dpasw
> node ./bin/www
internal/modules/cjs/loader.js:1032
throw err;
^
Error: Cannot find module 'src/MailHandler'
Require stack:
- /home/user/GIT/project/node_modules/node-dependency-injection/dist/lib/Loader/FileLoader.js
- /home/user/GIT/project/node_modules/node-dependency-injection/dist/lib/Loader/JsFileLoader.js
- /home/user/GIT/project/node_modules/node-dependency-injection/dist/lib/index.js
- /home/user/GIT/project/node_modules/node-dependency-injection-express-middleware/dist/index.js
- /home/user/GIT/project/app.js
- /home/user/GIT/project/bin/www
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1029:15)
at Function.Module._load (internal/modules/cjs/loader.js:898:27)
at Module.require (internal/modules/cjs/loader.js:1089:19)
at require (internal/modules/cjs/helpers.js:73:18)```
Compiler Pass and compile don´t work properly.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.