From the course: Node.js: Microservices
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Creating and testing the registration route - Node.js Tutorial
From the course: Node.js: Microservices
Creating and testing the registration route
- [Instructor] We just added a method to register and update services to the service registry class and we will now use this class method in our routes and we will now use this service class in our routes, and for that I'll open routes index.js and there I will first bring in this new class. So I add const Registry equals require and it's up there in lib/Registry. Then I will create an instance of this class because we saw before we have a constructor and we want to initiate it. So I add const registry, and now lowercase equals new uppercase Registry. So this will create the class instance for me. And next I will update this put route that is used to register and update services. For that I will first remove this return statement on line 12, and I will now add const, and I'm using a destructuring assignment here so I'm using curly brackets, and I say servicename, and we can basically just copy the params from here.…
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
-
-
-
-
-