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].
Package Version | Update ID | Released | Package Hub Version | Platforms | Subpackages |
---|---|---|---|---|---|
0.10.1.1-bp150.1.3 info | GA Release | 2018-07-30 | 15 |
|
|