$darkmode
#include <server.hpp>
Public Member Functions | |
| Server (const std::string &addr, int port) | |
| ~Server () | |
| void | set_threads (int n) |
| void | set_address (const std::string &addr) |
| const std::string & | address () const |
| void | set_port (int port) |
| int | port () const |
| bool | is_listening () const |
| void | listen () |
| fable::Json | endpoints_to_json (const std::vector< std::string > &endpoints) const |
| void | stop () |
| std::vector< std::string > | endpoints () const |
Protected Member Functions | |
| void | add_handler (const std::string &key, cloe::Handler h) |
Protected Attributes | |
| friend | StaticRegistrar |
| friend | LockedRegistrar |
| friend | BufferRegistrar |
A Server accepts and serves endpoints for Handlers.
This is a convenience wrapper around ServerImpl.
| oak::Server::~Server | ( | ) |
When a Server goes out of scope, it will stop listening for you if you haven't done so already.
|
protected |
Add a handler with the route muxer in the internal handler routine.
| std::vector< std::string > oak::Server::endpoints | ( | ) | const |
Return a list of all registered endpoints.
| fable::Json oak::Server::endpoints_to_json | ( | const std::vector< std::string > & | endpoints | ) | const |
Return endpoint data in json format.
|
inline |
Returns whether the server has started and is currently listening.
| void oak::Server::listen | ( | ) |
Start the server.
|
inline |
Set the address on which the server will listen.
|
inline |
Set the port on which to listen.
|
inline |
Set the number of threads used for listening to connections. This is the number of requests that can be handled simultaneously.
NOTE: This doesn't do anything at the moment; a new thread is created for each connection.
| void oak::Server::stop | ( | ) |
Stop the server.