express-oracle-session-ts

An Oracle session store for express.js writen in ts

Usage no npm install needed!

<script type="module">
  import expressOracleSessionTs from 'https://cdn.skypack.dev/express-oracle-session-ts';
</script>

README

Install

npm install express-oracle-session-ts

Usage

import express from "express";
import eos from "express-oracle-session-ts";
import session from "express-session";

const OracleSessionStore = eos(session);

const sessionStore = new OracleSessionStore({
  user: ORACLE.user,
  password: ORACLE.password,
  connectionString: ORACLE.conStr,
  schema: {
    tableName: "tbl_cloud_session",
  },
});

// Create Express server
const app = express();

app.use(
  session({
    resave: true,
    saveUninitialized: true,
    secret: SESSION_SECRET,
    store: sessionStore,
  })
);

Notes

  • this module was largely a port of express-oracle-session to typescript because at that time express-oracle-session failed to work with node oracle 5. But it seems that it has been updated recently probably to address this issue.
  • works with lastest node oracle (5+).
  • will create new table if the current session table doesn't not exist.
  • querying oracle DB, if failed, this module will retry three times. If it can't get the connection it will throw an error and exit the app (process.exit(1)).