Express.js session with sqlite

I am trying to configure a lightweight application with Express.js. I would like to use Sqlite3 for storage.

I need some sort of session management and try to use the session management module described in the Express instruction document, so (CoffeeScript)

g.app.configure -> g.app.set 'views', "#{__dirname}/views" g.app.set 'view engine', 'jade' g.app.use g.express.bodyParser() g.app.use g.express.cookieParser() g.app.use g.express.session(secret:'cruel') g.app.use g.express.methodOverride() g.app.use g.app.router g.app.use g.express.static "#{__dirname}/public" 

Now I would like to somehow save the sessions either in sqlite3, or as files in the project path.

All the examples I find use different types of NoSql databases.

Can anyone shed some light on where to find other session storage modules or even how to implement it.

+4
source share
2 answers

I think these 3 links will be useful to you:

http://senchalabs.github.com/connect/middleware-session.html (bottom of page)

https://github.com/senchalabs/connect/blob/master/lib/middleware/session/memory.js

(default storage for the session in which the embedded device is connected)

https://github.com/senchalabs/connect/wiki (session stores)

In the Connect (Connect Session) manual:

Session Storage Implementation

Each session store must implement the following methods.

 * .get(sid, callback) * .set(sid, session, callback) * .destroy(sid, callback) 

Recommended methods include, but are not limited to:

 * .length(callback) * .clear(callback) 

As an example of implementation, consider the connect-redis report.

 * param Object options * returns Function 
+3
source

All the examples I find use different types of NoSql databases.

The good thing about many of these NoSQL databases is that they are really easy to install. Installing redis is very simple and will make your site much faster (in a database backup) ...

Can anyone shed light on where to search for other session storage modules

I found the following modules using http://search.npmjs.org / http://github.com :

This is what I found quickly, but with a more thorough search, I believe that you can find even more session implementations.

or even how to implement it.

I think you should be able to use a supermarket basket, but you can also implement your own store using these links as a link:

+1
source

All Articles