Created
April 14, 2020 20:26
-
-
Save OdongAlican/bd9efb309e7eaff0c58b193bec92ffbe to your computer and use it in GitHub Desktop.
post view for the articles project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const postController = require('../controllers/post'); | |
const postRouter = express.Router(); | |
postRouter.param('id', postController.params); | |
postRouter.route('/posts') | |
.get(postController.get); | |
postRouter.route('/posts/:id') | |
.delete(postController.delete) | |
.get(postController.getOne); | |
postRouter.route('/author/:authorID/posts') | |
.post(postController.post); | |
postRouter.route('/authors/:authorId/posts/:postId') | |
.put(postController.update); | |
module.exports = postRouter; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment