Orbit Framework 2.0.0
A high-performance asynchronous C++20 HTTP server framework.
Loading...
Searching...
No Matches
GraphQL.hpp File Reference
#include <orbit/legacy_namespaces.hpp>
#include <orbit/http/HttpRequest.hpp>
#include <orbit/http/HttpResponse.hpp>
#include <orbit/http/ResponseWriter.hpp>
#include <functional>
#include <string>
#include <orbit/http/json.hpp>
Include dependency graph for GraphQL.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  orbit
 
namespace  orbit::middleware
 

Typedefs

using orbit::middleware::GraphQLExecutor = std::function< nlohmann::json(const std::string &query, const std::string &operation_name, const nlohmann::json &variables)>
 Signature for a GraphQL executor function. Takes the query string, operation name (optional), and variables (optional), and returns a JSON response (which should have "data" or "errors").
 

Functions

std::function< bool(http::HttpRequest &, std::shared_ptr< http::ResponseWriter >)> orbit::middleware::graphql (GraphQLExecutor executor)
 Creates a middleware handler for GraphQL endpoints. It parses the incoming GET or POST request according to the GraphQL over HTTP spec, extracts the query, operationName, and variables, and invokes the provided executor.