Latest Threat Research:Malicious dYdX Packages Published to npm and PyPI After Maintainer Compromise.Details
Socket
Book a DemoInstallSign in
Socket

trench-session

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

trench-session

Session middleware for [Trench](https://github.com/montyanderson/trench), using Redis.

latest
Source
npmnpm
Version
0.0.1
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

trench-session

Session middleware for Trench, using Redis.

Usage

const Trench = require("trench");
const session = require("trench-session");

const app = new Trench();

app.use(session({
	app: "app"
}));

app.get("/", (req, res) => {
	if(!req.session.i) req.session.i = 0;
	req.session.i++;

	res.end(req.session.i.toString());
});

app.listen(8080);

API

session([options])

Returns a middleware function to generate functions, then save them when res.end() is called.

options

app

Type: string

A name for the application, used so you can store multiple app's sessions in the same redis database, without possibility of interference.

expire

Type: number

Amount of seconds until the session expires, since last saved.

db

Type: string, object

Connection configuration, to be passed to redis.createClient().

client

Type: object

A redis client, i.e. created by redis.createClient().

FAQs

Package last updated on 06 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts