Class IApiServer

Inheritance Relationships

Derived Type

Class Documentation

class IApiServer

Provides an abstracted interface for creating an HTTP server.

Subclassed by axr::sdk::net::AbstractApiServer

Public Functions

virtual pplx::task<void> Listen(uint16_t Port) = 0

Starts the HTTP listening server.

Parameters

Port – The port number of the networking device to listen for incoming connections on.

virtual pplx::task<void> Stop() = 0

Stops the HTTP listen server.

virtual void Use(RequestHandler Handler) = 0

Registers a handler function that will be used in all HTTP request processing.

virtual void Use(const utility::string_t &Method, const utility::string_t &Path, std::initializer_list<RequestHandler> Handlers) = 0

Registers a handler function that will be used in HTTP request processing for the given method type and path.

virtual void Delete(utility::string_t Path, std::initializer_list<RequestHandler> Handlers) = 0

Registers the list of request handler functions to handle HTTP DELETE requests matching the specified path.

Parameters
  • Path – The endpoint path that the handler(s) will process.

  • Handlers – The list of request handler functions that will process HTTP DELETE requests for the given endpoint path.

virtual void Get(utility::string_t Path, std::initializer_list<RequestHandler> Handlers) = 0

Registers the list of request handler functions to handle HTTP GET requests matching the specified path.

Parameters
  • Path – The endpoint path that the handler(s) will process.

  • Handlers – The list of request handler functions that will process HTTP GET requests for the given endpoint path.

virtual void Head(utility::string_t Path, std::initializer_list<RequestHandler> Handlers) = 0

Registers the list of request handler functions to handle HTTP HEAD requests matching the specified path.

Parameters
  • Path – The endpoint path that the handler(s) will process.

  • Handlers – The list of request handler functions that will process HTTP HEAD requests for the given endpoint path.

virtual void Post(utility::string_t Path, std::initializer_list<RequestHandler> Handlers) = 0

Registers the list of request handler functions to handle HTTP POST requests matching the specified path.

Parameters
  • Path – The endpoint path that the handler(s) will process.

  • Handlers – The list of request handler functions that will process HTTP POST requests for the given endpoint path.

virtual void Put(utility::string_t Path, std::initializer_list<RequestHandler> Handlers) = 0

Registers the list of request handler functions to handle HTTP PUT requests matching the specified path.

Parameters
  • Path – The endpoint path that the handler(s) will process.

  • Handlers – The list of request handler functions that will process HTTP PUT requests for the given endpoint path.

virtual void Upgrade(utility::string_t Path, std::initializer_list<RequestHandler> Handlers) = 0

Registers the list of request handler functions to handle HTTP Upgrade (WebSocket) requests matching the specified path.

Parameters
  • Path – The endpoint path that the handler(s) will process.

  • Handlers – The list of request handler functions that will process HTTP Upgrade (WebSocket) requests for the given endpoint path.