The main server application. More...
#include <app.h>
Public Types | |
using | self_t = Crow |
This crow application. | |
using | server_t = Server< Crow, SocketAdaptor, Middlewares... > |
The HTTP server. | |
using | context_t = detail::context< Middlewares... > |
Public Member Functions | |
template<typename Adaptor > | |
void | handle_upgrade (const request &req, response &res, Adaptor &&adaptor) |
Process an Upgrade request. More... | |
void | handle (const request &req, response &res) |
Process the request and generate a response for it. | |
DynamicRule & | route_dynamic (std::string &&rule) |
Create a dynamic route using a rule (Use CROW_ROUTE instead) | |
template<uint64_t Tag> | |
auto | route (std::string &&rule) -> typename std::result_of< decltype(&Router::new_rule_tagged< Tag >)(Router, std::string &&)>::type |
Create a route using a rule (Use CROW_ROUTE instead) | |
CatchallRule & | catchall_route () |
Create a route for any requests without a proper route (Use CROW_CATCHALL_ROUTE instead) | |
self_t & | signal_clear () |
self_t & | signal_add (int signal_number) |
self_t & | port (std::uint16_t port) |
Set the port that Crow will handle requests on. | |
self_t & | timeout (std::uint8_t timeout) |
Set the connection timeout in seconds (default is 5) | |
self_t & | server_name (std::string server_name) |
Set the server name (default Crow/0.3) | |
self_t & | bindaddr (std::string bindaddr) |
The IP address that Crow will handle requests on (default is 0.0.0.0) | |
self_t & | multithreaded () |
Run the server on multiple threads using all available threads. | |
self_t & | concurrency (std::uint16_t concurrency) |
Run the server on multiple threads using a specific number. | |
self_t & | loglevel (crow::LogLevel level) |
Set the server's log level. More... | |
template<typename Duration , typename Func > | |
self_t & | tick (Duration d, Func f) |
Set a custom duration and function to run on every tick. | |
void | validate () |
A wrapper for validate() in the router. More... | |
void | notify_server_start () |
Notify anything using wait_for_server_start() to proceed. | |
void | run () |
Run the server. | |
void | stop () |
Stop the server. | |
void | debug_print () |
template<typename T , typename ... Remain> | |
self_t & | ssl_file (T &&, Remain &&...) |
template<typename T > | |
self_t & | ssl (T &&) |
template<typename T > | |
T::context & | get_context (const request &req) |
template<typename T > | |
T & | get_middleware () |
void | wait_for_server_start () |
Wait until the server has properly started. | |
The main server application.
Use SimpleApp
or App<Middleware1, Middleware2, etc...>
|
inline |
Process an Upgrade request.
Currently used to upgrrade an HTTP connection to a WebSocket connection
|
inline |
Set the server's log level.
Possible values are:
crow::LogLevel::Debug (0)
crow::LogLevel::Info (1)
crow::LogLevel::Warning (2)
crow::LogLevel::Error (3)
crow::LogLevel::Critical (4)
|
inline |
A wrapper for validate()
in the router.
Go through the rules, upgrade them if possible, and add them to the list of rules