Express js Request Handler
A request handler is a function that will be executed every time the server receives a particular request, usually defined by HTTP method. It accepts two parameters request and response.
Syntax of Request Handler
app.method('URI Template', callback){
...
})
The method can be get, post, put, delete, all. It accepts a url parameter in the first argument and callback function in the second argument. The callback function is a request handler. The request handler processes the request and write to the response object. This is similar to the callback in the core Node.js http.createServer() method.
Example
app.get('/user',
function(req, res){
res.send('Welcome user!');
});