How does Node.js handle dependency injection? In this video, learn how to set uNode.js to work like ASP.NET Core by setting up a service container and wrapping the Express functionality in a Server class.
- [Instructor] Now, as easy as this was to get running,…you probably have a lot of questions in your head,…like, "How do I build controllers?…"How do I do dependency injection?…"All the things I love about ASP .NET Core,…"how do I get those going in Node.js?"…Well, what we're going to do in this video…is actually roll our own dependency injection framework…and set up something that looks…a lot more like ASP .NET Core.…Now, this is totally optional.…You don't have to do this working with Node.js,…but if it makes you more comfortable, as a .NET,…C# developer, then I would do something like this.…So, first thing I'm going to do is go ahead…and clear out everything in our server.js file,…and I want to go ahead and create a config class.…
This is going to work like our service collection…in ASP .NET Core, and I'm just going to say…that I'm going to create something called config. (typing)…And I'm going to go ahead and create a server class.…(typing) Notice we're getting away…from the require notification.…I'll call that server, (typing)…
Released
12/14/2018- Installing and publishing Node.js packages
- Defining classes in Node.js
- Building a web API with Express and Node.js
- Unit testing in Node.js
- Continuous integration
Share this video
Embed this video
Video: Mimicking ASP.NET Core with Express