express Explain Routing in Express Express Router


Example

Express router allows you to create multiple "mini apps" so you can namespace your api, public, auth and other routes into separate routing systems.

var express   = require('express');
var app       = express();
var router    = express.Router();

router.get('/', function(req, res){
   res.send('Get request received');
});

router.post('/', function(req, res){
   res.send('Post requestreceived');
});

app.use('/', router);

app.listen(8080);