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 cart with all npm packages installed. Try it out:

var cart = require("cart")

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

cart v1.0.4

Connect session store using supermarket

This is a connect [1] session store using supermarket [2].

It was written by Peteris Krumins ( His blog is at -- good coders code, great reuse.

[1] [2]

Supermarket-cart can be used to store connect's sessions in supermarket database.

Here is a full application that starts a server on port 9005. When you first visit the root page /, it sets session name to be 'pkrumins'. Then when you visit /whoami, it will tell your name:

var Cart = require('cart');
var connect = require('connect');

var server = connect.createServer();
    store : new Cart({ dbFile : '/tmp/sessions.db' }),
    secret : 'your secret'
    connect.router(function (app) {
        app.get('/', function (req, res) {
   = 'pkrumins';
            res.writeHead(200, { 'Content-Type' : 'text/html' });
        app.get('/whoami', function (req, res) {
            res.writeHead(200, { 'Content-Type' : 'text/html' });

Have fun storing sessions in a supermarket cart!

Sincerely, Peteris Krumins


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