How to use connect-session-knex - 2 common examples

To help you get started, we’ve selected a few connect-session-knex examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rafaelalmeidatk / twitter-fullstack-clone / packages / server / src / app.js View on Github external
app.use(bodyParser.urlencoded({ extended: false }));
    app.use(cors({ origin: [process.env.FRONTEND_URL, 'http://localhost:3000'], credentials: true }));

    // Cookies settings

    const cookieSettings = {
      httpOnly: true,
      secure: IS_PRODUCTION,

    // Sessions

    const KnexSessionStore = connectSessionKnex(session);
    const store = new KnexSessionStore({ knex });
        cookie: cookieSettings,
        secret: 'test',
        resave: false,
        saveUninitialized: false,

    // Auth

    app.use(auth({ cookieSettings }));
github azchatlanin / / server / index.js View on Github external
import express from 'express'
import bodyParser from 'body-parser'
import path from 'path'
import morgan from 'morgan'
import Debug from 'debug'
import session from 'express-session'
import KnexSessionStore from 'connect-session-knex'
import db from './controllers/config/knex'
import devOptions from './controllers/config/dev.serv.opt'
import history from 'connect-history-api-fallback'
import serveStatic from 'serve-static'
// routes
import auth from './routes/auth'

const SessionStore = KnexSessionStore(session)
const store = new SessionStore({
  knex: db,
  tablename: 'session'
const debug = Debug('server:app')
const port = process.env.PORT || 5000
const app = express()

  secret: 'secret',
  saveUninitialized: true,
  resave: true,
  store: store


A knex.js session store for Express and Connect

Latest version published 6 months ago

Package Health Score

71 / 100
Full package analysis

Popular connect-session-knex functions

Similar packages