{"id":46943144,"url":"https://github.com/marcellowy/koa-session-store2","last_synced_at":"2026-03-11T07:12:39.043Z","repository":{"id":51975095,"uuid":"183360125","full_name":"marcellowy/koa-session-store2","owner":"marcellowy","description":"Middleware for Koa2 to get/set session use with custom stores such as Redis/Memcached/Mysql","archived":false,"fork":false,"pushed_at":"2023-09-15T06:41:32.000Z","size":178,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-27T21:44:15.711Z","etag":null,"topics":["koa-session","koa-session-store","session-store"],"latest_commit_sha":null,"homepage":"","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/marcellowy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-04-25T05:07:33.000Z","updated_at":"2023-09-15T06:32:49.000Z","dependencies_parsed_at":"2023-01-31T12:16:29.760Z","dependency_job_id":null,"html_url":"https://github.com/marcellowy/koa-session-store2","commit_stats":null,"previous_names":["marcellowy/koa-session-store"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/marcellowy/koa-session-store2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcellowy%2Fkoa-session-store2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcellowy%2Fkoa-session-store2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcellowy%2Fkoa-session-store2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcellowy%2Fkoa-session-store2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcellowy","download_url":"https://codeload.github.com/marcellowy/koa-session-store2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcellowy%2Fkoa-session-store2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30373685,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T06:09:32.197Z","status":"ssl_error","status_checked_at":"2026-03-11T06:09:17.086Z","response_time":84,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["koa-session","koa-session-store","session-store"],"created_at":"2026-03-11T07:12:38.389Z","updated_at":"2026-03-11T07:12:39.037Z","avatar_url":"https://github.com/marcellowy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# koa-session-store2\n\n*Requires Node 7.6 or greater for async/await support*\n\n## Getting Started\n\n### Installation\n\n    $ npm install koa-session-store2\n\n### Running Tests\n    Notice: please check test/config.js content\n    $ npm install\n    $ npm test\n\n## Examples\n```js\nconst session = require('koa-session');\nconst Koa = require('koa');\nconst app = new Koa();\n\n// memcached, redis, mysql example\n// Notice: Requires mysql 5.6 or grater for default value now()\nconst {MemcachedStore, RedisStore, MysqlStore} = require('koa-session-store2');\n\napp.keys = ['some secret hurr'];\n \nconst CONFIG = {\n    key: 'koa:sess', /** (string) cookie key (default is koa:sess) */\n    /** (number || 'session') maxAge in ms (default is 1 days) */\n    /** 'session' will result in a cookie that expires when session/browser is closed */\n    /** Warning: If a session cookie is stolen, this cookie will never expire */\n    maxAge: 86400000,\n    autoCommit: true, /** (boolean) automatically commit headers (default true) */\n    overwrite: true, /** (boolean) can overwrite or not (default true) */\n    httpOnly: true, /** (boolean) httpOnly or not (default true) */\n    signed: true, /** (boolean) signed or not (default true) */\n    rolling: false, /** (boolean) Force a session identifier cookie to be set on every response. The expiration is reset to the   original maxAge, resetting the expiration countdown. (default is false) */\n    renew: false, /** (boolean) renew session when session is nearly expired, so we can always keep user logged in. (default is false)*/\n    // store: new MemcachedStore(), /* defualt memcached config: localhost:11211 example: https://www.npmjs.com/package/memcached */\n    // store: new RedisStore(),\n    store: new MysqlStore('t_', \n        {\n          host     : '',\n          user     : '',\n          password : '',\n          database : ''\n        }\n    ),\n};\n \napp.use(session(CONFIG, app));\n\napp.use(ctx =\u003e {\n    // ignore favicon\n    if (ctx.path === '/favicon.ico') return;\n  \n    let n = ctx.session.views || 0;\n    ctx.session.views = ++n;\n    ctx.body = n + ' views';\n});\n \napp.listen(3000);\nconsole.log('listening on port 3000');\n```\n\n## License\n    MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcellowy%2Fkoa-session-store2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcellowy%2Fkoa-session-store2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcellowy%2Fkoa-session-store2/lists"}