Session manager for REST server without cookies

Usage no npm install needed!

<script type="module">
  import restifySession from '';



This module is made to manage session without cookies in a REST server powered by restify. Please install Redis (>=2.0.0) in your server to enable this module. To create documentation you must install JSDuck and type in your terminal:

$ ./


When you need to access to your REST server with session from a javascript app for iOS bundled as native app using Phonegap/Cordova, you can't use cookies because since iOS 5 these are disables by default.


Install restify-session as usual:

$ npm install --save restify-session


Is very simple to enable session:

// dependencies
var restify = require('restify'),
    session = require('restify-session')({
        debug : true,
        ttl   : 2

// create the server
var server  = restify.createServer();

// attach the session manager

// attach a route
server.get('/', function(req, res, next){
   res.send({ success: true, session: req.session });
   return next();

// start the server

Save this file as server.js and start it in a terminal window:

$ node server.js

Open your browser and put the address of your server:


Now you see an answer like this:


You can see your session id (sid) into the response header:

Session-Id ViS5pHE5n8McblTATbyFUJTGJyzVFeXOcAEZ41Zs

See full documentation into doc folder.

Run Tests

All tests are written in mocha and designed to be run with npm:

$ npm test