connect-mysql-store
v0.2.0
Published
A simple and minimal Connect/Express MySQL session store
Downloads
12
Readme
connect-mysql-store
A simple and minimal MySQL session store for Express session
Installation
npm install connect-mysql-store
Prerequisite
The database table to save the session data must exist. Following is the expected table schema.
CREATE TABLE sessions (
sid varchar(255) NOT NULL,
session varchar(2048) NOT NULL DEFAULT '',
updated TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (sid)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Usage
See more detailed explanation at Express session.
app.use(session({
secret: 'super secret!',
resave: true,
saveUninitialized: false,
store: new MySQLStore({
url: mysql://travis@localhost/connect_mysql_test
})
}));
Options
- url: (required). MySQL database connection string.
- table: (optional). Table name to save the sessions data. By default, name is 'sessions'.
License
MIT License