Skip to content
Download

created

mach::created

Creates a Created response.

Creates a 201 Created response, optionally containing the specified value.

// (1)
template <typename T>
[[nodiscard]] mach::Reply<T> created(T value);
// (2)
[[nodiscard]] mach::Reply<std::string> created(const char* value);
// (3)
[[nodiscard]] mach::Reply<> created();

A Created reply containing the specified value.

A Created reply containing the specified string.

A Created reply with no value.

Parameter Description
T The type of the response body.
Parameter Description
value The response body.
Parameter Description
value The response body.

Overload (2) converts the specified value to a std::string.

return mach::created(user);
return mach::created("User created.");
return mach::created();
Name Description
Reply Represents the result of an HTTP endpoint.
ControllerBase::created Creates a Created response from a controller.