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.
Unregistering services - Node.js Tutorial
From the course: Node.js: Microservices
Unregistering services
- [Instructor] Let's now create all the logic needed to remove services from the registry. For that, I open "lib" and "Registry.js," and I scroll down to simply add a new method there, and I call it "unregister." It, again, needs a name, a version, an IP, and a port to identify the service that needs to be deleted. And then we will, again, create the key of this service to find it in our map of services. And then we will just remove it from there. And as I now have a key creation again, I decided to factor out this logic into a dedicated function. So as you see in line eight in the register method, I already have this key creation. So let's just copy the part where we composed this ID, and I create the new method and let's call it "getKey." It gets the name, the version, the IP, and the port, and it returns name, version, IP, and port. Now, yes, Lint is complaining because we are not using this in this method and now…
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
-
-
-
-
-