roar
Loading...
Searching...
No Matches
router.hpp
Go to the documentation of this file.
1#pragma once
2
6
7#include <boost/beast/http/verb.hpp>
8#include <boost/beast/http/empty_body.hpp>
9
10#include <memory>
11#include <unordered_map>
12#include <functional>
13
14namespace Roar
15{
16 class Session;
17 template <typename>
18 class Request;
19
23 class Router : public std::enable_shared_from_this<Router>
24 {
25 public:
26 Router(std::shared_ptr<const StandardResponseProvider> standardResponseProvider);
28
34 void addRoutes(std::unordered_multimap<boost::beast::http::verb, ProtoRoute>&& routes);
35
41
42 private:
43 struct Implementation;
44 std::unique_ptr<Implementation> impl_;
45 };
46}
This class extends the boost::beast::http::request<BodyT> with additional convenience.
Definition request.hpp:52
The route routes http requests to their respective handler functions.
Definition router.hpp:24
void addRoutes(std::unordered_multimap< boost::beast::http::verb, ProtoRoute > &&routes)
Add new routes to this router.
Definition router.cpp:65
std::unique_ptr< Implementation > impl_
Definition router.hpp:44
void followRoute(Session &, Request< boost::beast::http::empty_body > request)
Find a follow route. Automatically responds with 404 when now route can be found.
Definition router.cpp:79
ROAR_PIMPL_SPECIAL_FUNCTIONS(Router)
Definition session.hpp:41
Definition authorization.hpp:10
Definition router.cpp:13