{"id":17592898,"url":"https://github.com/robinfehr/sessionstore","last_synced_at":"2025-04-30T06:41:51.285Z","repository":{"id":3575072,"uuid":"4637667","full_name":"robinfehr/sessionstore","owner":"robinfehr","description":"Sessionstore is a node.js module for multiple databases. It can be very useful if you work with express or connect.","archived":false,"fork":false,"pushed_at":"2021-05-18T09:42:04.000Z","size":175,"stargazers_count":54,"open_issues_count":12,"forks_count":22,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-04-15T12:18:49.650Z","etag":null,"topics":["connect","database","express","javascript","multiple-databases","sessionstore"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robinfehr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-06-12T13:29:14.000Z","updated_at":"2023-06-21T18:42:45.000Z","dependencies_parsed_at":"2022-09-26T16:21:25.748Z","dependency_job_id":null,"html_url":"https://github.com/robinfehr/sessionstore","commit_stats":null,"previous_names":["adrai/sessionstore"],"tags_count":50,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinfehr%2Fsessionstore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinfehr%2Fsessionstore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinfehr%2Fsessionstore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinfehr%2Fsessionstore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robinfehr","download_url":"https://codeload.github.com/robinfehr/sessionstore/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223775906,"owners_count":17200629,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["connect","database","express","javascript","multiple-databases","sessionstore"],"created_at":"2024-10-22T05:44:06.644Z","updated_at":"2024-11-09T02:28:06.721Z","avatar_url":"https://github.com/robinfehr.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Introduction\n\n[![travis](https://img.shields.io/travis/adrai/sessionstore.svg)](https://travis-ci.org/adrai/sessionstore) [![npm](https://img.shields.io/npm/v/sessionstore.svg)](https://npmjs.org/package/sessionstore)\n\nSessionstore is a node.js module for multiple databases. It can be very useful if you work with express or connect.\n\n# Installation\n\n    $ npm install sessionstore\n\n# Usage\n\n## Connecting to in-memory\n\n\tvar sessionstore = require('sessionstore');\n\n    var express = require('express');\n    var expressSession = require('express-session');\n    var app = express();\n\n    app.use(expressSession({\n        store: sessionstore.createSessionStore()\n    }));\n\n## Connecting to mongodb\n\n    var sessionstore = require('sessionstore');\n\n    var express = require('express');\n    var expressSession = require('express-session');\n    var app = express();\n\n    app.use(expressSession({\n        store: sessionstore.createSessionStore({\n            type: 'mongodb',\n            host: 'localhost',         // optional\n            port: 27017,               // optional\n            dbName: 'sessionDb',       // optional\n            collectionName: 'sessions',// optional\n            timeout: 10000             // optional\n            // authSource: 'authedicationDatabase',        // optional\n      \t    // username: 'technicalDbUser',                // optional\n      \t    // password: 'secret'                          // optional\n            // url: 'mongodb://user:pass@host:port/db?opts // optional\n        })\n    }));\n\n## Connecting to tingodb\n\n    var sessionstore = require('sessionstore');\n\n    var express = require('express');\n    var expressSession = require('express-session');\n    var app = express();\n\n    app.use(expressSession({\n        store: sessionstore.createSessionStore({\n            type: 'tingodb',\n            dbPath: __dirname + '/',   // optional\n            collectionName: 'sessions',// optional\n            timeout: 10000             // optional\n        })\n    }));\n\n## Connecting to couchdb\n\n    var sessionstore = require('sessionstore');\n\n    var express = require('express');\n    var expressSession = require('express-session');\n    var app = express();\n\n    app.use(expressSession({\n        store: sessionstore.createSessionStore({\n            type: 'couchdb',\n            host: 'http://localhost',  // optional\n            port: 5984,                // optional\n            dbName: 'express-sessions',// optional\n            collectionName: 'sessions',// optional\n            timeout: 10000             // optional\n        })\n    }));\n\n## Connecting to redis\n\n    var sessionstore = require('sessionstore');\n\n    var express = require('express');\n    var expressSession = require('express-session');\n    var app = express();\n\n    app.use(expressSession({\n        store: sessionstore.createSessionStore({\n            type: 'redis',\n            host: 'localhost',         // optional\n            port: 6379,                // optional\n            prefix: 'sess',            // optional\n            timeout: 10000             // optional\n        })\n    }));\n\n## Connecting to memcached\n\n    var sessionstore = require('sessionstore');\n\n    var express = require('express');\n    var expressSession = require('express-session');\n    var app = express();\n\n    app.use(expressSession({\n        store: sessionstore.createSessionStore({\n            type: 'memcached',\n            host: 'localhost',         // optional\n            port: 11211,               // optional\n            prefix: 'sess',            // optional\n            retries: 2,                // optional\n            failover: false,           // optional\n            failoverTime: 60,          // optional\n            timeout: 10000             // optional\n        })\n    }));\n\n## Connecting to elasticsearch\n\n    var sessionstore = require('sessionstore');\n\n    var express = require('express');\n    var expressSession = require('express-session');\n    var app = express();\n\n    app.use(expressSession({\n        store: sessionstore.createSessionStore({\n            type: 'elasticsearch',\n            host: 'localhost:9200',    // optional\n            prefix: '',                // optional\n            index: 'express',          // optional\n            typeName: 'session',       // optional\n            pingInterval: 1000,        // optional\n            timeout: 10000             // optional\n        })\n    }));\n\n## Catch connect and disconnect events\n\n    var ss = sessionstore.createSessionStore({ type: 'mongodb' }, function(err, ss) {\n        console.log('hello from callback');\n        // use store here...\n        // app.use(expressSession({\n        //     store: ss\n        // }));\n    });\n    ss.on('connect', function() {\n        console.log('hello from event');\n        // or here\n        // app.use(expressSession({\n        //     store: ss\n        // }));\n    });\n    ss.on('disconnect', function() {\n        console.log('bye');\n    });\n\n#[Release notes](https://github.com/adrai/sessionstore/blob/master/releasenotes.md)\n\n# Database Support\nCurrently these databases are supported:\n\n1. inmemory\n2. mongodb ([node-mongodb-native] (https://github.com/mongodb/node-mongodb-native))\n3. couchdb ([cradle] (https://github.com/cloudhead/cradle))\n4. tingodb ([tingodb] (https://github.com/sergeyksv/tingodb))\n5. redis ([redis] (https://github.com/mranney/node_redis))\n6. memcached ([memjs] (https://github.com/alevy/memjs))\n7. elasticsearch ([elasticsearch] (https://github.com/elastic/elasticsearch-js))\n\n\n# License\n\nCopyright (c) 2020 Adriano Raiano\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobinfehr%2Fsessionstore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobinfehr%2Fsessionstore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobinfehr%2Fsessionstore/lists"}