A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/EarthlingInteractive/koa-generic-session-knex below:

EarthlingInteractive/koa-generic-session-knex: Store Koa sessions in a database using knex.

Store Koa sessions in a database using knex.

This session storage provider works with koa-generic-session (session middleware for Koa) and with koa-session-minimal (session middleware for Koa 2).

It stores session data in a database defined by you, using the Knex query builder.

It has been tested with SQLite and PostgreSQL.

Forked and modified from koa-generic-session-sequelize.

npm install --save koa-generic-session-knex

Full example in examples/basic_sqlite.js.

const KnexStore = require('koa-generic-session-knex');

// set up Knex in the usual manner
// for a quick example using the sqlite3 module:
const knex = Knex({
  client: 'sqlite3',
  connection: {
    filename: "./mydb.sqlite"
  }
});

app.use(session({
  store: new KnexStore(
    knex,            // pass your knex object as the first arg
    {}                    // pass any config options for knexStore as the second arg (see below)
  )
}));

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.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4