#include <uwebsockets/App.h>
#include <functional>
#include <nlohmann/json.hpp>
#include <string>
#include <string_view>
Go to the source code of this file.
|
| namespace | mm |
| |
| namespace | mm::node |
| |
| namespace | mm::api |
| | HTTP-transport glue shared by the built-in server and route plug-in libs.
|
| |
|
| template<typename Res > |
| void | mm::api::sendJson (Res *res, std::string_view corsOrigin, const nlohmann::json &body) |
| | Writes body as a 200 application/json response with the CORS header.
|
| |
| template<typename Res > |
| void | mm::api::sendError (Res *res, std::string_view status, std::string_view corsOrigin, std::string_view message) |
| | Writes a status response carrying a {"error": message} JSON body and the CORS header.
|
| |
| template<typename Res > |
| void | mm::api::sendStatus (Res *res, std::string_view status, std::string_view corsOrigin) |
| | Writes a bare status response (no body) with the CORS header.
|
| |