Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including connect-nedb-session with all npm packages installed. Try it out:

var connectNedbSession = require("connect-nedb-session")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

connect-nedb-session v0.0.3

Nedb-backed session store for Connect/Express session middleware

connect-nedb-session

NeDB-backed session store for the Connect/Express session middleware.

Install and test

npm install connect-nedb-session
npm test

How to use

// If you use Connect alone
var connect = require('connect')
 , session = connect.session
 , NedbStore = require('connect-nedb-session')(session);

// If you use Express
var express = require('express')
 , session = express.session
 , NedbStore = require('connect-nedb-session')(session);

// If you use Express 4.x
var express = require('express')
 , session = require('express-session')
 , NedbStore = require('connect-nedb-session')(session);

// Use with the session middleware (replace express with connect if you use Connect)
server.use(session({ secret: 'yoursecret'
                   , key: 'yoursessionkey'
                   , cookie: { path: '/'
                             , httpOnly: true
                             , maxAge: 365 * 24 * 3600 * 1000   // One year for example
                             }
                   , store: new NedbStore({ filename: 'path_to_nedb_persistence_file' })
                   }));

License

MIT

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free