how set up a router in express code example
Example 1: express route parameters
app.get('/users/:userId/books/:bookId', function (req, res) {
res.send(req.params)
})
Example 2: express() vs express.router()
var express = require('express'),
dogs = require('./routes/dogs'),
cats = require('./routes/cats'),
birds = require('./routes/birds');
var app = express();
app.use('/dogs', dogs);
app.use('/cats', cats);
app.use('/birds', birds);
app.listen(3000);