Orbit Framework
An ultra-modern, asynchronous, cross-platform C++ Web Framework.
Loading...
Searching...
No Matches
GraphQL.hpp File Reference
#include <orbit/http/HttpRequest.hpp>
#include <orbit/http/HttpResponse.hpp>
#include <functional>
#include <string>
#include <orbit/http/json.hpp>
Include dependency graph for GraphQL.hpp:

Go to the source code of this file.

Namespaces

namespace  middleware
 

Typedefs

using 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 >)> 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.