@conga/framework-session
Session handler for the Conga.js Framework
Last updated 2 years ago by createvibe .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @conga/framework-session 
SYNC missed versions from official npm registry.

@conga/framework-session

This bundle enabled sessions for the CongaJS framework. The Sessions are built on top of express-session and allow you to provide your own mixins for the session object.

See the documentation for more information.

Configuration

# app/config/config.yml
 
session:
 
    # see https://github.com/expressjs/session for info
 
    secret: 'session-secret'
    resave: true
    saveUninitialized: true
 
    cookie:
        name: conga.sid
 
    # the session store configuration
    store:
        # any supported express-session store
        module: session-file-store
        
        # the store options here
        # NOTE: some stores have their own options
        options:
            path: "%kernel.var_path%/sessions"
            ttl: 7200
            retries: 4
            fileExtension: .session
 
    # if you leave out mixins alltogether they will be enabled
    mixins:
        # to turn off mixins, change this value to false
        enabled: true
        
        # to keep mixins enabled but disable only certain mixins
        # list each mixin that you want to disable here
        disabled:
            - flashBag

Accessing The Session

The session lives on the request object.

You have access to this on a controller action method.

const { Controller } = require('@conga/framework');
 
module.exports = class MyController extends Controller {
    /**
     * @Route("/", name="index", methods=["GET"])
     */
    index(req, res) {
        // add data to your session
        req.session.set('name', 'some value');
        
        // get data from the session
        res.return({data: req.session.get('some_key')});
    }
}

Current Tags

  • 2.0.4                                ...           latest (2 years ago)

10 Versions

  • 2.0.4                                ...           2 years ago
  • 2.0.3                                ...           2 years ago
  • 2.0.2                                ...           2 years ago
  • 2.0.1                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 2.0.9-dev                                ...           2 years ago
  • 2.0.8-dev                                ...           2 years ago
  • 2.0.7-dev                                ...           2 years ago
  • 2.0.6-dev                                ...           2 years ago
  • 2.0.5-dev                                ...           2 years ago
Downloads
Today 0
This Week 0
This Month 10
Last Day 0
Last Week 10
Last Month 2
Dependencies (1)
Dev Dependencies (7)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |