How to use connect-pg-simple - 4 common examples

To help you get started, we’ve selected a few connect-pg-simple 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 adeperio / base / src / server / server.js View on Github external
import express from 'express';

import session from 'express-session';
import cookieParser from 'cookie-parser';
import path from 'path';
import bodyParser from 'body-parser';
import methodOverride from 'method-override';

import https from 'https';
import fs from 'fs';
import sslRootCas from 'ssl-root-cas';
import helmet from 'helmet';
import express_enforces_ssl from 'express-enforces-ssl';
import pg from 'pg';
import ConnectPg from 'connect-pg-simple';
var pgSession = ConnectPg(session);
import csurf from 'csurf';

import signInRoutes from './middleware/routes/sign-in-routes.js';
import signOutRoutes from './middleware/routes/sign-out-routes.js';
import signUpRoutes from './middleware/routes/sign-up-routes.js';
import userRoutes from './middleware/routes/user-routes.js';

import passport from './middleware/auth/passport.js';
import error from './middleware/error/error.js';

var server = express();

// ======== *** VIEWS AND TEMPLATES ***

//Set port
github tomalrussell / colouring-london / app / src / server.tsx View on Github external
import db from './db';
import tileserver from './tiles/tileserver';
import apiServer from './api/api';
import frontendRoute from './frontendRoute';

// create server
const server = express();

// disable header

// serve static files

// handle user sessions
const pgSession = pgConnect(session);
const sess: any = { // TODO: remove any
    name: 'cl.session',
    store: new pgSession({
        pgPromise: db,
        tableName: 'user_sessions'
    secret: process.env.APP_COOKIE_SECRET,
    saveUninitialized: false,
    resave: false,
    cookie: { maxAge: 30 * 24 * 60 * 60 * 1000 } // 30 days
if (server.get('env') === 'production') {
    // trust first proxy
    server.set('trust proxy', 1)
    // serve secure cookies = true
github reactGo / reactGo / server / db / postgres / session.js View on Github external
import session from 'express-session';
import pg from 'pg';
import connectPostgres from 'connect-pg-simple';
import { db } from '../sequelize/constants';

const PGStore = connectPostgres(session);

export default () =>
  new PGStore(
      conString: db
github sheshbabu / freshlytics / src / server / libs / Postgres.ts View on Github external
function getSessionStore(session: Session) {
  const pgSession = connectPgSimple(session);
  return new pgSession({ pool });


A simple, minimal PostgreSQL session store for Connect/Express

Latest version published 4 months ago

Package Health Score

71 / 100
Full package analysis

Popular connect-pg-simple functions

Similar packages