Skip to content

Instantly share code, notes, and snippets.

@kasramp

kasramp/index.js Secret

Created May 21, 2020 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kasramp/9fd8b685622c9a36754192ae84240bd1 to your computer and use it in GitHub Desktop.
Save kasramp/9fd8b685622c9a36754192ae84240bd1 to your computer and use it in GitHub Desktop.
router.delete("/v1/users/:id", (context) => {
if (context.params && context.params.id && !isNaN(parseInt(context.params.id))) {
dummyUsers.splice(context.params.id - 1, 1);
context.response.status = 204;
} else {
context.response.status = 400;
context.response.body = { error: "Id must be number" };
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment