Created
April 16, 2018 13:42
-
-
Save soner8/e8f30867388afc8d999f9601f082924c to your computer and use it in GitHub Desktop.
Delete.js
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
var express = require('express'); | |
var router = express.Router(); | |
//PUT | |
router.get('/:nom((\[a-z]+))', function (req, res, next) { | |
res.render('update-user', { | |
id: req.params.nom | |
}); | |
}); | |
router.put('/:nom((\[a-z]+))', function (req, res, next) { | |
res.send('The new name is ' + req.params.nom) | |
}); | |
//DELETE | |
router.get('/:numero(\\d+)', function (req, res, next) { | |
res.render('delete-user', { | |
num: req.params.numero | |
}); | |
}); | |
router.delete('/:numero(\\d+)', function (req, res, next) { | |
res.send('No more user ' + req.params.numero) | |
}); | |
module.exports = router; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment