libcex
1.0.0
Modern C++11 embedded webserver library
|
libcex
- embeddeded C++11 webserver.
If cmake cannot find your OpenSSL installation, or you've installed in a non-standard location, you might want to add -DOPENSSL_ROOT_DIR=/path/to/ssl
to the cmake call.
libcex
is built around the concept of middleware functions which serve both for routing and also for request/response interaction and processing. A minimal example might look like:
The cex::Server class provides a set of functions to attach middlewares for various situations. Middleware functions can be installed for a given HTTP method (GET, POST) or for a given URL-path. Each middleware function receives 3 parameters:
All registered middleware functions are executed in the order they have been registered, for each request. A middleware function is only executed, when its specification (HTTP method, URL-path) matches the incoming request. Execution of middlewares stops as soon as one of the following happens:
next
method is not calledThe method cex::Response::end is used to send a response to the client. This can be just a statuscode, or also a payload. If no registered middleware calls