Skip to content

x.sessions.vweb2_middleware #

fn create #

fn create[T, X](mut s sessions.Sessions[T]) vweb.MiddlewareOptions[X]

middleware can be used to add session middleware to your vweb app to ensure a valid session always exists. If a valid session exists the session data will be loaded into session_data, else a new session id will be generated. You have to pass the Context type as the generic type

Example

app.use(app.sessions.middleware[Context]())