app.delete()

Routes HTTP DELETE requests for a path to handler functions.

Since Express 4 Spec ↗

Syntax

app.delete(path, ...handlers)

Parameters

NameTypeRequiredDescription
path string | RegExp Yes The route path.
handlers ...function Yes The handler chain.

Returns

Application — The app instance, for chaining.

Examples

app.delete('/users/:id', (req, res) => {
  removeUser(req.params.id);
  res.sendStatus(204);
});
Output
$ curl -X DELETE localhost:3000/users/1
(204 No Content)
app.delete('/cache', (req, res) => {
  clearCache();
  res.json({ cleared: true });
});
Output
{"cleared":true}

Notes

`delete` is a reserved-word-safe method name on the app object. A successful delete typically returns 204 (no body) or 200 with a result. Make it idempotent: deleting an already-gone resource can still return 204.

See also