public final class SessionsMiddleware : Middleware, ServiceType
Uses HTTP cookies to save and restore sessions for connecting clients.
If a cookie matching the configured cookie name is found on an incoming request,
the value will be used as an identifier to find the associated
If a session is used during a request (
Request.session()), a cookie will be set
on the outgoing response with the session’s unique identifier. This cookie must be
returned on the next request to restore the session.
var middlewareConfig = MiddlewareConfig() middlewareConfig.use(SessionsMiddleware.self) services.register(middlewareConfig)
public static func makeService(for container: Container) throws -> SessionsMiddleware