cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

An expression-session-store for Neo4j

Hi everyone.

I wrote a session store for neo4j and express-session. You can use it with

npm install neo4j-session-store

The use case is here that you want a web session store on Neo4j, for example because you only want to have one database in your app.

const STORE_OPTIONS = {
  table: {
    name: "sessions",
    hashKey: "sessionId",
    hashPrefix: "sessions:",
  },
  neo4jConfig: {
    neo4jurl: "bolt://localhost:7687",
    neo4juser: "neo4j",
    neo4jpwd: "test",
  },
  touchInterval: 0,
};

var Neo4jSessionStore = require('Neo4jSessionStore').default;

var sessionConfig = {
    secret: 'mysecret',
    store: new Neo4jSessionStore(STORE_OPTIONS),
    resave: false,
    saveUninitialized: false,
    genid: (req) => {
        return uuidv4(); 
    },
    cookie: {
        httpOnly: true,
        sameSite: 'strict',
    }
}

app.use(session(sessionConfig));

Yours,

Jan Brogger

0 REPLIES 0