Skip to content

andyengle/connect-mysql

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#connect-mysql

This is a very, very simple MySQL backed session store for connect.

It uses an already established node-mysql client for the connection, and creates a 'sessions' table if it doesn't exist.

To use:

var express = require('express'),
    mysql = require('mysql').createClient({ user: 'dbuser', password: 'dbpassword', database: 'db' }),
    MySQLStore = require('connect-mysql')(express);

var app = express.createServer();
app.use(express.cookieParser());
app.use(express.session({ secret: 'supersecretkeygoeshere', store: new MySQLStore({ client: mysql })));

For MySQL pool support:

...
    mysql = require('mysql').createPool({ user: 'dbuser', password: 'dbpassword', database: 'db' }),
...

Options:

  • client - the mysql client instance or pool
  • cleanup - a boolean specifying whether to enable the cleanup events. note that if this is disabled, cleanup will not take place at all and should be done externally.

License: MIT

About

A very small MySQL session store for connect

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%