Skip to content

Instantly share code, notes, and snippets.

@bahayman
Last active September 21, 2016 15:21
Show Gist options
  • Save bahayman/f4402234e7c2955c02a089eb81c4c668 to your computer and use it in GitHub Desktop.
Save bahayman/f4402234e7c2955c02a089eb81c4c668 to your computer and use it in GitHub Desktop.
Express router chaining
var dealsRouter = express.Router();
dealsRouter.get('/', function (req, res) {
res.send("/deals/" + req.params.id);
});
dealsRouter.get('/:id', function (req, res) {
res.send("/deals/" + req.params.id);
});
app.use('/deals', dealsRouter);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment