MantisBase v0.3.4
Loading...
Searching...
No Matches
types.h
Go to the documentation of this file.
1
9#ifndef MANTISBASE_TYPES_H
10#define MANTISBASE_TYPES_H
11
12#include <httplib.h>
13#include <nlohmann/json.hpp>
14
15namespace mb {
16 class MantisBase;
17 class MantisRequest;
18 class MantisResponse;
19 class MantisContentReader;
20 class Entity;
21 class EntitySchema;
22 class EntitySchemaField;
23
24 namespace fs = std::filesystem;
25
26 class KeyValStore;
27 class Database;
28 class Logger;
29 class Router;
30 class Files;
31
32 using json = nlohmann::json;
33 using HandlerResponse = httplib::Server::HandlerResponse;
34
36 using HandlerFn = std::function<void(MantisRequest&, MantisResponse&)>;
37
41
44
46 using Middlewares = std::vector<MiddlewareFn>;
47
49 using Method = std::string;
50
52 using Path = std::string;
53
55 using RouteKey = std::pair<Method, Path>;
56
57#define REQUEST_HANDLED HandlerResponse::Handled;
58#define REQUEST_PENDING HandlerResponse::Unhandled;
59}
60
61#endif //MANTISBASE_TYPES_H
‍Middleware shorthand for the content reader
Definition http.h:552
A wrapper class around httplib::Request offering a consistent API and allowing for easy wrapper metho...
Definition http.h:42
Wrapper around httplib::Response for consistent API.
Definition http.h:318
router.h
Definition auth.h:15
std::pair< Method, Path > RouteKey
‍Shorthand notation for the request's method, path pair.
Definition types.h:55
std::vector< MiddlewareFn > Middlewares
‍Middleware function arrays
Definition types.h:46
std::string Path
‍Syntactic sugar for request path which is a std::string
Definition types.h:52
std::function< HandlerResponse(MantisRequest &, MantisResponse &)> MiddlewareFn
‍Middleware shorthand for the function
Definition types.h:43
std::function< void(MantisRequest &, MantisResponse &, MantisContentReader &)> HandlerWithContentReaderFn
‍Route Handler function with content reader shorthand
Definition types.h:40
httplib::Server::HandlerResponse HandlerResponse
Definition types.h:33
std::function< void(MantisRequest &, MantisResponse &)> HandlerFn
‍Route Handler function shorthand
Definition types.h:36
std::string Method
‍Syntactic sugar for request method which is a std::string
Definition types.h:49
nlohmann::json json
Shorten JSON namespace.
Definition context_store.h:18