# Request

The req object represents the HTTP request and has properties for the request query string, parameters, body, HTTP headers, and so on. In this documentation and by convention, the object is always referred to as req (and the HTTP response is res) but its actual name is determined by the parameters to the callback function in which you’re working.

Route.get('/user/:id',(req,res)=> {
    res.send('user'+ req.params.id);
});

The req object is an enhanced version of Node’s own request object and supports all built-in fields and methods.

# req.originalUrl

The originalUrl method returns the request's path information which is the path of the request URL. So, if the incoming request is targeted at http://example.com/api/createBook, the path method will return createBook:

# req.baseUrl

The Url path on which a router instance was mounted.

# req.method

The method method will return the HTTP verb for the request. This can be a GET,POST,PUT DELETE and so on.

For more on request and response, visit expressjs.com (opens new window).