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 - 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
-
-
-
-
-
-
What's your goal for this chapter?1m 59s
-
(Locked)
Setting up the registry5m 6s
-
(Locked)
Registering services6m 55s
-
(Locked)
Creating and testing the registration route5m 9s
-
(Locked)
Unregistering services9m 27s
-
(Locked)
Querying the registry8m 23s
-
(Locked)
Removing expired services7m 18s
-
(Locked)
Registering on service on start5m 9s
-
(Locked)
Adding heartbeat and unregistering on shutdown4m 53s
-
-
-
-
-