Skip to content
Download

mapDelete

mach::App::mapGet

Registers a handler for HTTP DELETE requests.

Registers a handler for HTTP DELETE requests matching the specified route pattern.

template <typename THandler>
void mapDelete(std::string_view pattern, THandler&& handler);
Name Description
pattern The route pattern to match (e.g. “/api/users”).
handler The handler invoked when a request matches the route pattern.
Exception Condition
std::logic_error Thrown if a route with the same HTTP method and route pattern has already been registered.
  • The endpoint is registered immediately when this function is called.
  • OPTIONS requests are handled automatically by the framework.

This function is not thread-safe. Concurrent route registration must be synchronized externally.

app.mapDelete("/users/{id:int}", [](int id) {
return mach::noContent();
});
Name Description
mapGet Registers a handler for HTTP GET requests.
mapPost Registers a handler for HTTP POST requests.
mapPut Registers a handler for HTTP PUT requests.
mapPatch Registers a handler for HTTP PATCH requests.
mapHead Registers a handler for HTTP HEAD requests.