Advertisement
Guest User

Untitled

a guest
May 22nd, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. ```js
  2. const albums = require('express').Router();
  3.  
  4. //...
  5.  
  6. // Our app.use in the last file forwards a request to our albums router.
  7. // So this route actually handles `/albums` because it's the root route when a request to /albums is forwarded to our router.
  8. albums.get('/', function(req, res, next) {
  9. // res.send() our response here
  10. });
  11.  
  12.  
  13. // A route to handle requests to any individual album, identified by an album id
  14. albums.get('/:albumId', function(req, res, next) {
  15. let myAlbumId = req.params.albumId;
  16. // get album data from server and res.send() a response here
  17. });
  18.  
  19. //...
  20.  
  21. module.exports = albums;
  22. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement