Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Database session support in nodejs/express [closed]

Does expressjs/nodejs have support (via a module?) for database sessions? I come from the world of PHP/CodeIgniter and I've enjoyed the features of storing session data in a mysql database table.

Is this approach used with nodejs web apps?

like image 209
Casey Flynn Avatar asked Apr 13 '12 07:04

Casey Flynn


People also ask

Where is session data stored in Express session?

By default, express-session creates a new MemoryStore instance for storing session data in server. However, in production, it is not recommended to use the default memory store, as mentioned in the official documentation. We should use other modules, such as connect-redis , a Redis-based session store.

How does express session expire?

var session = require('express-session') To expire the session after 1 min of inactivity in express-session of Express.

What is Express session in node JS?

Express-session - an HTTP server-side framework used to create and manage a session middleware. This tutorial is all about sessions. Thus Express-session library will be the main focus. Cookie-parser - used to parse cookie header to store data on the browser whenever a session is established on the server-side.

What is the difference between Express session and cookie session?

Cookie session is basically used for lightweight session applications where the session data is stored in a cookie but within the client [browser], whereas, Express Session stores just a mere session identifier within a cookie in the client end, whilst storing the session data entirely on the server.


1 Answers

Yes.

Redis

  • https://github.com/visionmedia/connect-redis

MySQL

  • https://github.com/mren/connect-session-mysql Broken Link
  • https://github.com/CarnegieLearning/connect-mysql-session Old, Unsupported
  • https://github.com/chill117/express-mysql-session

PostgreSQL

  • https://github.com/jebas/connect-pg

MongoDB

  • https://github.com/kcbanner/connect-mongo
  • https://github.com/bartt/connect-session-mongo
  • https://github.com/donpark/session-mongoose
  • https://github.com/masylum/connect-mongodb

Memcached

  • https://github.com/balor/connect-memcached

CouchDB

  • https://github.com/tdebarochez/connect-couchdb
  • https://github.com/eldios/connect-cradle

Riak

  • https://github.com/frank06/connect-riak

SQLite

  • https://github.com/tnantoka/connect-sqlite
  • https://github.com/pkrumins/supermarket-cart

File-based

  • https://github.com/odogono/connect-session-file
  • https://github.com/tnantoka/connect-fs

Kyoto-cabinet

  • https://github.com/kazupon/connect-kyoto

Azure

  • https://github.com/pofallon/connect-bluesky

nStore

  • https://github.com/creationix/nstore-session

node-dirty

  • https://github.com/mmichelli/connect-dirty

VOC (?)

  • https://github.com/triAGENS/SessionVoc-Connect.js

It's quite simple to implement your own, see documentation here.

like image 167
Ricardo Tomasi Avatar answered Sep 22 '22 09:09

Ricardo Tomasi