express使用msyql存储session

Example

var express = require('express')  
var app = module.exports = express()  

var session = require('express-session')  
var SessionStore = require('express-mysql-session')  

 var options = {  
    host: 'localhost',  
    port: 3306,  
    user: 'session_test',  
    password: 'password',  
    database: 'session_test'  
 }  

app.use(session({  
        key: 'session_cookie_name',  
       secret: 'session_cookie_secret',  
       store: new SessionStore(options)  
 }))

你可能感兴趣的:(express使用msyql存储session)