You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constKnexStore=require('koa-generic-session-knex');// set up Knex in the usual manner// for a quick example using the sqlite3 module:constknex=Knex({client: 'sqlite3',connection: {filename: "./mydb.sqlite"}});app.use(session({store: newKnexStore(knex,// pass your knex object as the first arg{}// pass any config options for knexStore as the second arg (see below))}));
Options
tableName - Name of the session table in the db (default: Sessions)
sync - Create the sessions table if it doesn’t exist (default: true)
syncTimeout - If sync is true, how long to wait, in ms, for the sync to complete (default: 3000)
gcFrequency - Do garbage collection after approximately this many requests. This deletes expired session data from the table. Set to 0 to never do garbage collection. (default: 10000, or approximately every 10,000 requests)
timestamps - If true, the table will have updated_at and created_at columns. (default: false)
browserSessionLifetime - How long, in ms, to remember sessions without a TTL: sessions that only last until the browser is closed. Some session managers, including koa-session-minimal, will ignore this and use a reasonable default. (default: 86400000)
Unit tests
To run the test suite, clone this repository and run npm install in the checkout directory. Then run npm test. This will exercise the library against SQLite.
To test against MySQL, PostgreSQL, or SQL Server, edit test/config.js. Uncomment sections referencing those servers and enter your credentials. The table _sess_test will be created during testing.