22#include "anch-rest-server-export.hpp"
33#include "rest/cors.hpp"
34#include "rest/endpoint.hpp"
35#include "rest/filter.hpp"
36#include "rest/method.hpp"
37#include "rest/request.hpp"
38#include "rest/response.hpp"
68 class ANCH_REST_SERVER_EXPORT
Api {
79 std::unique_ptr<Node> _root;
82 std::vector<anch::rest::Filter> _filters;
85 std::optional<anch::rest::CorsOptions> _cors;
251 static std::vector<std::string> parsePattern(std::string_view pattern);
260 void addRoute(std::unique_ptr<anch::rest::Route>
route);
280 static std::set<anch::rest::Method> allowedMethods(
const std::vector<Match>& matches);
336#include "rest/impl/api.hpp"
anch::rest::Endpoint< std::decay_t< F > > & route(anch::rest::Method method, std::string_view pattern, F &&function)
Api & operator=(const Api &)=delete
anch::rest::Endpoint< std::decay_t< F > > & del(std::string_view pattern, F &&function)
Api(Api &&other) noexcept
anch::rest::Endpoint< std::decay_t< F > > & put(std::string_view pattern, F &&function)
Api & operator=(Api &&other) noexcept
Api & cors(anch::rest::CorsOptions options)
anch::rest::Endpoint< std::decay_t< F > > & patch(std::string_view pattern, F &&function)
anch::rest::Response handle(anch::rest::Request &request) noexcept
Api & filter(anch::rest::Filter filter)
anch::rest::Endpoint< std::decay_t< F > > & get(std::string_view pattern, F &&function)
anch::rest::Endpoint< std::decay_t< F > > & post(std::string_view pattern, F &&function)
Definition endpoint.hpp:324
Definition request.hpp:50
Definition response.hpp:47
AnCH REST library namespace.
Definition auth.hpp:29
Method
Definition method.hpp:36
std::function< anch::rest::Response(anch::rest::Request &, const anch::rest::Next &)> Filter
Definition filter.hpp:36
Status
Definition status.hpp:36