Motion Master 6.0.0-alpha.86
Next-generation motion control software
Loading...
Searching...
No Matches
router.cc File Reference
#include "api/router.h"
#include <spdlog/spdlog.h>
#include <atomic>
#include <charconv>
#include <cstdint>
#include <memory>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
Include dependency graph for router.cc:

Namespaces

namespace  mm
 
namespace  mm::api
 HTTP-transport glue shared by the built-in server and route plug-in libs.
 

Functions

std::string mm::api::percentDecode (std::string_view text)
 Percent-decodes a URL path component — %20 to a space, %2F to a slash.
 
Response mm::api::json (const nlohmann::json &body)
 A 200 response carrying body as JSON.
 
Response mm::api::bytes (std::string contentType, std::string body)
 A 200 response carrying body verbatim under contentType.
 
Response mm::api::error (std::string status, std::string_view message)
 A status response carrying a {"error": message} body.
 
Response mm::api::badRequest (std::string_view message)
 A 400 with message — the most common failure, so it gets a name.
 
Response mm::api::notFound (std::string_view message)
 A 404 with message.
 
Response mm::api::statusOnly (std::string status)
 A bare status response with no body — a 202 that means "under way", a 204 delete.
 
Response mm::api::withWireTime (Response response, std::chrono::microseconds wireUs)
 Attaches the server-measured device time (X-Wire-Us) to response and returns it.
 
std::vector< std::string > mm::api::parameterNames (std::string_view pattern)
 The :name tokens of a route pattern, in the order uWS will index them.