Skip to content

whity/raku-hematite-middleware-session

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
 
 
t
 
 
 
 
 
 
 
 
 
 
 
 

Hematite Session Middleware

test

Usage

use Logger;
use Hematite;
use Hematite::Middleware::Session;

class App is Hematite::App {
    method startup {
        self.log.level = Logger::DEBUG;

        # encrypted cookie
        # self.use(
        #     Hematite::Middleware::Session.create(
        #         store => {
        #             type   => 'cookie',
        #             secret => 'secret', # encryption secret key (required),
        #             # secret => ['current', 'old'],
        #         },
        #         cookie     => 'sid',
        #         expires_in => '1hour',
        #     )
        # );

        # redis
        # self.use(
        #     Hematite::Middleware::Session.create(
        #         store => {
        #             type => 'redis',
        #             host => '127.0.0.1',
        #             port => '6379',
        #         },
        #         cookie     => 'sid',
        #         expires_in => '1hour',
        #     )
        # );

        self.GET('/', sub ($ctx) {
            # get session/flash value
            say $ctx.flash<y>;
            say $ctx.session<x>;

            # set session/flash values
            $ctx.flash<y>   = 'y';
            $ctx.session<x> = 'x';

            return $ctx.render('session middleware test', inline => True);
        });
    }
}

TODO

  • better doc
  • unit tests
  • ...

Contributing

  1. Fork it ( https://github.com/[your-github-name]/raku-hematite-middleware-session/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages