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

var connectMl = require("connect-ml")

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

connect-ml v0.1.0

MarkLogic session store for Connect

connect-ml

MarkLogic session store for Express and Connect. Also you can use it with Koa

MarkLogic session store is a provision for storing session data as json in MarkLogic Server

Compatibility

Getting Started

Installation

$ npm install connect-ml
  • prefix The directory where the session files will be stored. Defaults to /sess/
  • client The marklogic DatabaseClient instance.
  • logErrors The function for logging errors
  • ttl Session time to live in seconds. Defaults to 86400 (24 hours)

Usage

Express or Connect integration

Due to express >= 4 changes, we need to pass express-session to the function connect-ml exports in order to extend session.Store:

var session = require('express-session');
var marklogic = require('marklogic');
var MlStore = require('connect-ml')(session);
var db = marklogic.createDatabaseClient(connInfo);

app.use(session({
    store: new MlStore({
        client: db
    }),
    secret: 'keyboard cat',
    resave: true,
    saveUninitialized: true
}));

Metadata

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