node.jsexpresssession-variablesnode.js-connectlocomotivejs

How to use sessions in Locomotive.js


I am giving a look at the node.js web framework Locomotive. Since it is built on top of Express, I suppose Connect middleware should be easily accessible, but I can't find out how.

I added 2 lines to config/environments/all.js:

this.use(express.cookieParser());
this.use(express.session({ secret: 'keyboard cat'}));

Where is the session object now?


Solution

  • I found out by myself. It was quite easy:

    var express = require('express');
    var sess = express.session;