libcex
1.0.0
Modern C++11 embedded webserver library
|
Session middleware function. More...
Go to the source code of this file.
Classes | |
struct | cex::SessionOptions |
Contains all options for the sessionHandler middleware. More... | |
Functions | |
MiddlewareFunction | cex::sessionHandler (std::shared_ptr< SessionOptions > opts=nullptr) |
Creates a middleware function which gets/creates session IDs. More... | |
Session middleware function.
Example:
MiddlewareFunction cex::sessionHandler | ( | std::shared_ptr< SessionOptions > | opts = nullptr | ) |
Creates a middleware function which gets/creates session IDs.
Extracts the cookie with the configured name from the request. If no cookie could be found, a new session ID is created and a cookie is attached to the Response object. The session ID is also added to the Request object's property list. The name of the property corresponds to the cookie/session ID name.