Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

nesting express routes

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

// api/products
router.get('/', function(req, res) {
  res.json({ products: [] });
});

// api/products/:id
router.get('/:id', function(req, res) {
  res.json({ id: req.params.id });
});

module.exports = router;
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #nesting #express #routes
ADD COMMENT
Topic
Name
6+8 =