Routing Response
Routing in Node.js refers to determining the action to take for a specific request, based on the URL of the request.
Here's an example of how you could implement routing using an if...else
statement.
When a client makes a request to the home page ('/'
), the first route handler will be executed, and the response will be "Welcome to nodejs guide.". Similarly, when a client makes a request to the about page ('/about'
), the second route handler will be executed, and the response will be "Sab janna h isko."
Last updated