simple-session-0.10.1.1: Cookie-based session management for the Simple web framework
Adds cookie-based session management to simple Controller
s. To add to an
application, declare the Controller setting's type an instance of
HasSession
, and wrap routes with withSession
. For example:
data AppSettings = ... instance HasSession AppSettings where ...
controllerApp settings $ withSessions $ do routeName \"posts\" $ ...
Then, in your controllers you can seemlessly get and set keys from the session:
get "/profile" $ do muserId <- sessionLookup "current_user_id" case muserIf of Nothing -> respond $ redirectTo "/login" Just userId -> [handle request]
Modules
- Web
- Simple