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

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