mirror of
https://github.com/wassname/talk.git
synced 2026-08-17 11:27:52 +08:00
Wrapped server routes into path based managment style
This commit is contained in:
@@ -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;
|
||||
Reference in New Issue
Block a user