Orbit Framework 2.0.0
A high-performance asynchronous C++20 HTTP server framework.
Loading...
Searching...
No Matches
orbit.hpp File Reference

Everything a typical Orbit application needs, in one include. More...

#include <orbit/legacy_namespaces.hpp>
#include <orbit/server/App.hpp>
#include <orbit/server/Timer.hpp>
#include <orbit/routing/Router.hpp>
#include <orbit/routing/HandlerWrapper.hpp>
#include <orbit/config/Config.hpp>
#include <orbit/config/ConfigFile.hpp>
#include <orbit/http/HttpRequest.hpp>
#include <orbit/http/HttpResponse.hpp>
#include <orbit/http/ResponseWriter.hpp>
#include <orbit/http/RequestContext.hpp>
#include <orbit/http/MultipartForm.hpp>
#include <orbit/http/MultipartStreamParser.hpp>
#include <orbit/http/MultipartUpload.hpp>
#include <orbit/http/Client.hpp>
#include <orbit/http/WebSocketConnection.hpp>
#include <orbit/websocket/EventRouter.hpp>
#include <orbit/concurrency/Task.hpp>
#include <orbit/concurrency/Awaitable.hpp>
#include <orbit/concurrency/ThreadPool.hpp>
#include <orbit/openapi/OpenApi.hpp>
#include <orbit/middleware/Compress.hpp>
#include <orbit/middleware/Cors.hpp>
#include <orbit/middleware/Csrf.hpp>
#include <orbit/middleware/DistributedRateLimiter.hpp>
#include <orbit/middleware/GraphQL.hpp>
#include <orbit/middleware/JwtAuth.hpp>
#include <orbit/middleware/Metrics.hpp>
#include <orbit/middleware/OAuth2.hpp>
#include <orbit/middleware/Observability.hpp>
#include <orbit/middleware/Proxy.hpp>
#include <orbit/middleware/RateLimiter.hpp>
#include <orbit/middleware/SecurityHeaders.hpp>
#include <orbit/middleware/SessionManager.hpp>
#include <orbit/middleware/StaticFiles.hpp>
#include <orbit/middleware/TrustedProxies.hpp>
#include <orbit/middleware/Validation.hpp>
#include <orbit/testing/Client.hpp>
#include <orbit/utils/Logger.hpp>
#include <memory>
Include dependency graph for orbit.hpp:

Go to the source code of this file.

Namespaces

namespace  orbit
 

Typedefs

Short aliases for the names an application writes constantly.

Everything here is also reachable at its full, namespaced name (orbit::server::App, orbit::http::HttpResponse, ...); these are nothing more than using aliases to it, so either spelling works interchangeably, including in code that mixes the two.

using orbit::App = server::App
 
using orbit::Request = http::HttpRequest
 
using orbit::Response = http::HttpResponse
 
using orbit::Status = http::HttpStatus
 
using orbit::Method = http::HttpMethod
 
using orbit::Writer = std::shared_ptr< http::ResponseWriter >
 What a handler or middleware receives to answer a request: std::shared_ptr<http::ResponseWriter>.
 
using orbit::RouteHandler = routing::RouteHandler
 
using orbit::Middleware = routing::Middleware
 
using orbit::json = nlohmann::json
 nlohmann::json, Orbit's JSON type, already used throughout Request/Response (req.json(), res.json(...)).
 

Detailed Description

Everything a typical Orbit application needs, in one include.

#include <orbit/orbit.hpp>
int main() {
app.get("/hello", [](orbit::Request&, orbit::Writer w) {
w->send(orbit::Response().json({{"message", "hi"}}));
});
app.listen();
}
Represents an HTTP response to be sent to a client.
Definition HttpResponse.hpp:107
The main application class for the Orbit Framework.
Definition App.hpp:36
App & get(const std::string &path, routing::RouteHandler handler)
Registers a GET route.
void listen()
Starts the server and blocks the current thread.
std::shared_ptr< http::ResponseWriter > Writer
What a handler or middleware receives to answer a request: std::shared_ptr<http::ResponseWriter>.
Definition orbit.hpp:98
Everything a typical Orbit application needs, in one include.
Definition Config.hpp:30
Represents an incoming HTTP request.
Definition HttpRequest.hpp:54

Leaves out the database clients and ORM (<orbit/orm/*.hpp>, <orbit/database/*.hpp>): they pull in vcpkg dependencies (libpq, libmysqlclient, mongoc, ...) that not every application uses, so they stay separate includes. Everything else — the server, routing, the built-in middleware, WebSockets, the test client, outbound HTTP — is here.