From the course: Node.js: Microservices

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Registering services

Registering services - Node.js Tutorial

From the course: Node.js: Microservices

Registering services

- [Instructor] In this video, we will start creating the logic for our service registry. And for that, I will first create a class that will contain this logic. So, I head into lib. And in lib, I now create a new file, and I call it simply registry.js. And in there, I start out with creating a class, class registry. And in there, I will now create a constructor. So, this time, it's not a static class like the service classes we had before, because I want to store a few things in the class instance. So, I start with constructor. And in there, I will now do two things. I will first instantiate the array that will later contain a list of all our services. Please note that we will not use a database in this case, but store our services directly in memory on this class. And as the services, as you will later see, keep re-registering themselves, restarting the registry should actually not be a problem. The…

Contents