MantisBase v0.4.9
Loading...
Searching...
No Matches
types.h File Reference

Core type aliases, handler signatures, and the MbAppMixin DI mixin. More...

#include <nlohmann/json.hpp>
#include <functional>
#include <string>
#include <vector>
#include <filesystem>
#include "../export.h"
Include dependency graph for types.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  mb::MbAppMixin
 Non-owning access to the active MantisBase from DI-aware types. More...

Namespaces

namespace  mb

Macros

#define REQUEST_HANDLED   MbHandlerResponse::Handled;
#define REQUEST_PENDING   MbHandlerResponse::Unhandled;

Typedefs

using mb::MbHandlerFn = std::function<void(MbRequest&, MbResponse&)>
 Standard route handler (request, response).
using mb::MbMiddlewareFn = std::function<MbHandlerResponse(MbRequest&, MbResponse&)>
using mb::MbMiddlewares = std::vector<MbMiddlewareFn>
using mb::MbMethod = std::string
using mb::MbPath = std::string
using mb::MbRouteKey = std::pair<MbMethod, MbPath>
 Route lookup key: HTTP method + path pattern.

Enumerations

enum class  mb::MbHandlerResponse { mb::Handled , mb::Unhandled }
 Middleware short-circuit result: stop or continue the chain. More...

Detailed Description

Core type aliases, handler signatures, and the MbAppMixin DI mixin.

Defines the function types used throughout routing (HandlerFn, MiddlewareFn) and the non-owning MantisBase reference mixin inherited by request/response wrappers and service classes.

Macro Definition Documentation

◆ REQUEST_HANDLED

#define REQUEST_HANDLED   MbHandlerResponse::Handled;

◆ REQUEST_PENDING

#define REQUEST_PENDING   MbHandlerResponse::Unhandled;