Skip to content
Download

mapPatch

mach::App::mapPost

Registers a handler for HTTP PATCH requests.

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

template <typename THandler>
void mapPatch(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.mapPatch("/users/{id:int}", [](const UpdateUserEmailRequest& request) {
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.
mapDelete Registers a handler for HTTP DELETE requests.
mapHead Registers a handler for HTTP HEAD requests.