Nothing Special   »   [go: up one dir, main page]

5.0.0 • Published 9 months ago

connect-session-knex v5.0.0

Weekly downloads
9,017
License
ISC
Repository
github
Last release
9 months ago

Connect Session Knex

NPM Version NPM Downloads Node.js Version NPM

connect-session-knex is an express-session store backed by PostgreSQL, MySQL, MariaDB, MSSQL, Oracle or SQLite3, via the knex.js library.

Installation

$ npm install connect-session-knex

History

See Changelog.md

Usage

Example application using the defaults

Example application with PostgreSQL

Options

  • cleanupInterval milliseconds between clearing expired sessions. Defaults to 60000. 0 disables the automatic clearing of expired sessions.
  • createTable if the table for sessions should be created automatically or not.
  • knex knex instance to use. Defaults to a new knex instance, using sqlite3 with a file named 'connect-session-knex.sqlite'
  • tableName='sessions' Tablename to use. Defaults to 'sessions'.
  • sidFieldName='sid' Field name in table to use for storing session ids. Defaults to 'sid'.

If the table does not exist in the schema, this module will attempt to create it unless the createTable option is false.

If a knex instance is not provided, this module will attempt to create a sqlite3 database, with a file named connect-session-knex.sqlite, in the working directory of the process.

Schema

PostgreSQL or SQLite

Table Name "sessions"

ColumnTypeModifiersStorage
sidcharacter varying(255)not nullextended
sessjsonnot nullextended
expiredtimestamp with time zonenot nullplain

Indexes:

    "sessions_pkey" PRIMARY KEY, btree (sid)
    "sessions_expired_index" btree (expired)

MySQL

Table Name sessions.

ColumnTypeModifiers
sidVARCHAR(255)NOT NULL, PK
sessJSONNOT NULL
expiredDATETIMENOT NULL

Command to manually create table:

CREATE TABLE `sessions` (
  `sid` VARCHAR(255) NOT NULL,
  `sess` JSON NOT NULL,
  `expired` DATETIME NOT NULL,
  PRIMARY KEY (`sid`));

Testing

Install Postgresql

Instructions for Ubuntu after intalling the db:

sudo -u postgres psql
CREATE DATABASE travis_ci_test OWNER postgres;
GRANT all privileges ON DATABASE travis_ci_test TO postgres;
ALTER USER postgres WITH PASSWORD 'postgres';
\q

Install Mysql

Instructions for Ubuntu after installing the db:

sudo mysql -u root
create user 'travis' identified by 'travis';
ALTER USER 'travis'@'localhost' IDENTIFIED BY 'travis';
create database travis_ci_test;
grant all on travis_ci_test.* to 'travis';
\q
sudo service mysql restart

Make sure both the MySQL and Postgres services are running

npm run test
5.0.0

9 months ago

4.0.2

9 months ago

4.0.1

9 months ago

4.0.0

1 year ago

3.0.1

2 years ago

2.1.2

3 years ago

3.0.0

3 years ago

2.1.1

3 years ago

2.1.0

4 years ago

2.0.0

4 years ago

1.7.3

5 years ago

1.7.2

5 years ago

1.7.1

5 years ago

1.7.0

5 years ago

1.6.0

5 years ago

1.5.0

5 years ago

1.4.0

8 years ago

1.3.4

8 years ago

1.3.3

8 years ago

1.3.2

8 years ago

1.3.1

8 years ago

1.3.0

8 years ago

1.2.0

8 years ago

1.1.0

8 years ago

1.0.23

9 years ago

1.0.22

9 years ago

1.0.21

9 years ago

1.0.20

9 years ago

1.0.19

9 years ago

1.0.18

9 years ago

1.0.17

9 years ago

1.0.16

9 years ago

1.0.15

9 years ago

1.0.14

10 years ago

1.0.13

10 years ago

1.0.12

10 years ago

1.0.11

10 years ago

1.0.10

10 years ago

1.0.9

10 years ago

1.0.8

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.0.2

11 years ago

0.0.1

11 years ago