roar
Loading...
Searching...
No Matches
proto_route.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <boost/beast/http/empty_body.hpp>
4#include <roar/cors.hpp>
6
7#include <string>
8#include <functional>
9#include <variant>
10#include <regex>
11
12namespace Roar
13{
18 {
21
24
26 std::optional<CorsSettings> cors;
27 };
28
29 namespace Detail
30 {
32 {
33 std::string basePath;
34 };
35 }
36
37 class Session;
38 template <typename>
39 class Request;
40
45 {
46 std::variant<std::string, std::regex, Detail::ServedPath> path;
47 std::function<void(Session& session, Request<boost::beast::http::empty_body>&& req)> callRoute;
48 std::function<bool(std::string const&, std::vector<std::string>&)> matches;
50 };
51}
This class extends the boost::beast::http::request<BodyT> with additional convenience.
Definition request.hpp:52
Definition session.hpp:41
Definition authorization.hpp:10
Definition proto_route.hpp:32
std::string basePath
Definition proto_route.hpp:33
A proper Route is built up from this object. This object is usually created internally.
Definition proto_route.hpp:45
std::function< bool(std::string const &, std::vector< std::string > &)> matches
Definition proto_route.hpp:48
RouteOptions routeOptions
Definition proto_route.hpp:49
std::variant< std::string, std::regex, Detail::ServedPath > path
Definition proto_route.hpp:46
std::function< void(Session &session, Request< boost::beast::http::empty_body > &&req)> callRoute
Definition proto_route.hpp:47
Options that modify the server behavior for a given route.
Definition proto_route.hpp:18
bool expectUpgrade
Set this to true if you expect a websocket upgrade request on this route.
Definition proto_route.hpp:23
bool allowUnsecure
If the server is an https server, setting this to true will allow unencrypted requests on this route.
Definition proto_route.hpp:20
std::optional< CorsSettings > cors
Set this to provide automatically generated cors headers and preflight requests.
Definition proto_route.hpp:26