Security News
Namecheap Takes Down Polyfill.io Service Following Supply Chain Attack
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
connect-session-knex
Advanced tools
Readme
connect-session-knex is an express-session store backed by PostgreSQL, MySQL, MariaDB, MSSQL, Oracle or SQLite3, via the knex.js library.
$ npm install connect-session-knex
See Changelog.md
Example application using the defaults
Example application with PostgreSQL
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.
Column | Type | Modifiers | Storage |
---|---|---|---|
sid | character varying(255) | not null | extended |
sess | json | not null | extended |
expired | timestamp with time zone | not null | plain |
"sessions_pkey" PRIMARY KEY, btree (sid)
"sessions_expired_index" btree (expired)
Table Name sessions
.
Column | Type | Modifiers |
---|---|---|
sid | VARCHAR(255) | NOT NULL, PK |
sess | JSON | NOT NULL |
expired | DATETIME | NOT 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`));
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
FAQs
A knex.js session store for Express and Connect
The npm package connect-session-knex receives a total of 59,103 weekly downloads. As such, connect-session-knex popularity was classified as popular.
We found that connect-session-knex demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.
Security News
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.