All Projects → robinfehr → Sessionstore

robinfehr / Sessionstore

Licence: mit
Sessionstore is a node.js module for multiple databases. It can be very useful if you work with express or connect.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Sessionstore

Nodejs Restful Api
How to create a RESTful CRUD API using Nodejs?
Stars: ✭ 285 (+448.08%)
Mutual labels:  database, express
Stackoverflow Clone
Clone project of a famous Q/A website for developers which is stackoverflow built using MySQL-Express-React-Node 🌐
Stars: ✭ 182 (+250%)
Mutual labels:  database, express
Connect Session Sequelize
Sequelize SessionStore for Express/Connect
Stars: ✭ 179 (+244.23%)
Mutual labels:  database, express
Securing Restful Apis With Jwt
How to secure a Nodejs RESTful CRUD API using JSON web tokens?
Stars: ✭ 301 (+478.85%)
Mutual labels:  database, express
React Node Learn
一个脚手架项目,node+express+react快速搭建大前端项目,实现前后端分离
Stars: ✭ 51 (-1.92%)
Mutual labels:  express
Couchdb Net
EF Core-like CouchDB experience for .NET!
Stars: ✭ 50 (-3.85%)
Mutual labels:  database
Postgresclientkit
A PostgreSQL client library for Swift. Does not require libpq.
Stars: ✭ 49 (-5.77%)
Mutual labels:  database
Nsdb
Natural Series Database
Stars: ✭ 49 (-5.77%)
Mutual labels:  database
Node Typescript Boilerplate
Minimalistic project template to jump start a Node.js back-end application in TypeScript. ESLint, Jest and type definitions included.
Stars: ✭ 1,061 (+1940.38%)
Mutual labels:  express
Bibsearch
Download, manage, and search a BibTeX database.
Stars: ✭ 52 (+0%)
Mutual labels:  database
Icinema
A Full Stack MERN app with CRUD operations for theatres where users can search for movies that are available and admin can add a movie to the list and much more.
Stars: ✭ 51 (-1.92%)
Mutual labels:  express
Rqlite
The lightweight, distributed relational database built on SQLite
Stars: ✭ 9,147 (+17490.38%)
Mutual labels:  database
Hunt Entity
An object-relational mapping (ORM) framework for D language (Similar to JPA / Doctrine), support PostgreSQL and MySQL.
Stars: ✭ 51 (-1.92%)
Mutual labels:  database
Racingworld
💥 A multiplayer online 3D game about racing 💥
Stars: ✭ 50 (-3.85%)
Mutual labels:  database
Molecule
Scala meta-DSL for the Datomic database
Stars: ✭ 51 (-1.92%)
Mutual labels:  database
Spring Boot Angular5
This repository has a sample code base for spring boot and angular 5 integration.
Stars: ✭ 49 (-5.77%)
Mutual labels:  database
Awesome Ebooks
收录开源的经典技术书籍 PDF 文件及相关网站,持续更新中...
Stars: ✭ 51 (-1.92%)
Mutual labels:  database
Laravel Transactional Model Events
Add eloquent model events fired after a transaction is committed or rolled back
Stars: ✭ 52 (+0%)
Mutual labels:  database
Meme Studio
📌 A complete and fast website building in React/Express for creating and sharing "internet memes"
Stars: ✭ 51 (-1.92%)
Mutual labels:  express
Faunadb Jvm
Scala and Java driver for FaunaDB
Stars: ✭ 50 (-3.85%)
Mutual labels:  database

Introduction

travis npm

Sessionstore is a node.js module for multiple databases. It can be very useful if you work with express or connect.

Installation

$ npm install sessionstore

Usage

Connecting to in-memory

var sessionstore = require('sessionstore');

var express = require('express');
var expressSession = require('express-session');
var app = express();

app.use(expressSession({
    store: sessionstore.createSessionStore()
}));

Connecting to mongodb

var sessionstore = require('sessionstore');

var express = require('express');
var expressSession = require('express-session');
var app = express();

app.use(expressSession({
    store: sessionstore.createSessionStore({
        type: 'mongodb',
        host: 'localhost',         // optional
        port: 27017,               // optional
        dbName: 'sessionDb',       // optional
        collectionName: 'sessions',// optional
        timeout: 10000             // optional
        // authSource: 'authedicationDatabase',        // optional
  	    // username: 'technicalDbUser',                // optional
  	    // password: 'secret'                          // optional
        // url: 'mongodb://user:[email protected]:port/db?opts // optional
    })
}));

Connecting to tingodb

var sessionstore = require('sessionstore');

var express = require('express');
var expressSession = require('express-session');
var app = express();

app.use(expressSession({
    store: sessionstore.createSessionStore({
        type: 'tingodb',
        dbPath: __dirname + '/',   // optional
        collectionName: 'sessions',// optional
        timeout: 10000             // optional
    })
}));

Connecting to couchdb

var sessionstore = require('sessionstore');

var express = require('express');
var expressSession = require('express-session');
var app = express();

app.use(expressSession({
    store: sessionstore.createSessionStore({
        type: 'couchdb',
        host: 'http://localhost',  // optional
        port: 5984,                // optional
        dbName: 'express-sessions',// optional
        collectionName: 'sessions',// optional
        timeout: 10000             // optional
    })
}));

Connecting to redis

var sessionstore = require('sessionstore');

var express = require('express');
var expressSession = require('express-session');
var app = express();

app.use(expressSession({
    store: sessionstore.createSessionStore({
        type: 'redis',
        host: 'localhost',         // optional
        port: 6379,                // optional
        prefix: 'sess',            // optional
        timeout: 10000             // optional
    })
}));

Connecting to memcached

var sessionstore = require('sessionstore');

var express = require('express');
var expressSession = require('express-session');
var app = express();

app.use(expressSession({
    store: sessionstore.createSessionStore({
        type: 'memcached',
        host: 'localhost',         // optional
        port: 11211,               // optional
        prefix: 'sess',            // optional
        retries: 2,                // optional
        failover: false,           // optional
        failoverTime: 60,          // optional
        timeout: 10000             // optional
    })
}));

Connecting to elasticsearch

var sessionstore = require('sessionstore');

var express = require('express');
var expressSession = require('express-session');
var app = express();

app.use(expressSession({
    store: sessionstore.createSessionStore({
        type: 'elasticsearch',
        host: 'localhost:9200',    // optional
        prefix: '',                // optional
        index: 'express',          // optional
        typeName: 'session',       // optional
        pingInterval: 1000,        // optional
        timeout: 10000             // optional
    })
}));

Catch connect and disconnect events

var ss = sessionstore.createSessionStore({ type: 'mongodb' }, function(err, ss) {
    console.log('hello from callback');
    // use store here...
    // app.use(expressSession({
    //     store: ss
    // }));
});
ss.on('connect', function() {
    console.log('hello from event');
    // or here
    // app.use(expressSession({
    //     store: ss
    // }));
});
ss.on('disconnect', function() {
    console.log('bye');
});

#Release notes

Database Support

Currently these databases are supported:

  1. inmemory
  2. mongodb ([node-mongodb-native] (https://github.com/mongodb/node-mongodb-native))
  3. couchdb ([cradle] (https://github.com/cloudhead/cradle))
  4. tingodb ([tingodb] (https://github.com/sergeyksv/tingodb))
  5. redis ([redis] (https://github.com/mranney/node_redis))
  6. memcached ([memjs] (https://github.com/alevy/memjs))
  7. elasticsearch ([elasticsearch] (https://github.com/elastic/elasticsearch-js))

License

Copyright (c) 2020 Adriano Raiano

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].