Mantis App v0.1.13
Loading...
Searching...
No Matches
http.h File Reference

Wrapper around http-lib to add middleware support and context values to be passed from middlewares up to the last handler. More...

#include <httplib.h>
#include <unordered_map>
#include <any>
#include <functional>
#include <string>
#include <vector>
#include <nlohmann/json.hpp>
#include "logging.h"
Include dependency graph for http.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  mantis::Context
 
struct  mantis::RouteKeyHash
 
struct  mantis::RouteHandler
 Struct encompassing the list of middlewares and the handler function registered to a specific route. More...
 
class  mantis::RouteRegistry
 
class  mantis::HttpUnit
 

Namespaces

namespace  mantis
 router.h
 

Macros

#define REQUEST_HANDLED   false
 
#define REQUEST_PENDING   true
 

Typedefs

using mantis::Request = httplib::Request
 

‍Shorthand for httplib::Request


 
using mantis::Response = httplib::Response
 

‍Shorthand for httplib::Response


 
using mantis::Middleware = std::function< bool(const Request &, Response &, Context &)>
 

‍Middleware shorthand for the function


 
using mantis::RouteHandlerFunc = std::function< void(const Request &, Response &, Context &)>
 

‍Route Handler function shorthand


 
using mantis::Method = std::string
 

‍Syntactic sugar for request method which is a std::string


 
using mantis::Path = std::string
 

‍Syntactic sugar for request path which is a std::string


 
using mantis::RouteKey = std::pair< Method, Path >
 

‍Shorthand notation for the request's method, path pair.


 

Detailed Description

Wrapper around http-lib to add middleware support and context values to be passed from middlewares up to the last handler.

Created by allan on 12/05/2025.

Macro Definition Documentation

◆ REQUEST_HANDLED

#define REQUEST_HANDLED   false

◆ REQUEST_PENDING

#define REQUEST_PENDING   true