Wrapped server routes into path based managment style

This commit is contained in:
Wyatt Johnson
2016-10-31 16:09:04 -06:00
parent 289a2866e7
commit 4963d1f05c
11 changed files with 163 additions and 98 deletions
+25
View File
@@ -0,0 +1,25 @@
const express = require('express');
const router = express.Router();
router.get('/', (req, res) => {
res.send('Read all of the comments ever');
});
router.get('/:comment_id', (req, res) => {
res.send('Read a comment');
});
router.post('/', (req, res) => {
res.send('Write a comment');
});
router.put('/:comment_id', (req, res) => {
res.send('Update a comment');
});
router.delete('/:comment_id', (req, res) => {
res.send('Delete a comment');
});
module.exports = router;