Skip to content

Instantly share code, notes, and snippets.

@jwoyo
Last active November 13, 2019 14:53
Show Gist options
  • Save jwoyo/2eafb99ab73c51334432a921dd9f63c1 to your computer and use it in GitHub Desktop.
Save jwoyo/2eafb99ab73c51334432a921dd9f63c1 to your computer and use it in GitHub Desktop.
app.delete("/:restaurantId", [onlyLoggedInUsers, restaurantOwnerOnlyMiddleware], (req, res) => {
// an user which doesn't fulfill the preconditions from the middlewares above, will not reach the code below
// do your delete operation here
res.send();
});
// you can simple re-use the implementation above
app.put("/:restaurantId", [onlyLoggedInUsers, restaurantOwnerOnlyMiddleware], (req, res) => {
// do your put operation here
res.send();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment