How to use the connect-session-sequelize function in connect-session-sequelize

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

github LibreTubeApp / LibreTube / src / server.js View on Github external
import { db, User } from './graphql/connectors';
import parseXml from './utils/parseXml';
import startCron from './utils/cron';
import { setupPassport, buildHelmetOptions } from './utils/auth';

const port = parseInt(process.env.PORT, 10) || 3000
const dev = process.env.NODE_ENV !== 'production'
const app = next({ dev });
const handle = app.getRequestHandler()
const server = express();

setupPassport();
startCron();

const schema = makeExecutableSchema({ typeDefs, resolvers });
const SequelizeStore = storeBuilder(session.Store);

if (process.env.PROXY === 'true') {
  server.set('trust proxy', 1); // trust first proxy
}

// Middlewares
server.disable('x-powered-by');
server.use(helmet(buildHelmetOptions()));
server.use(bodyParser.json());
server.use(session({
  store: new SequelizeStore({ db }),
  secret: 'dogs',
  name: 'session',
  cookie: {
    secure: process.env.HTTPS === 'true',
    expires: new Date(Date.now() + 48 * 60 * 60 * 1000) // 48 hours
github labzero / lunch / src / server.js View on Github external
app.use((req, res, next) => {
  if (req.hostname === 'lunch.labzero.com') {
    res.redirect(301, generateUrl(req, config.bsHost, path));
  } else {
    next();
  }
});

//
// Session / Flash
// -----------------------------------------------------------------------------
if (__DEV__) {
  app.enable('trust proxy');
}

const SequelizeStore = connectSessionSequelize(session.Store);
app.use(session({
  cookie: {
    domain: config.domain,
    secure: process.env.NODE_ENV === 'production'
  },
  saveUninitialized: false,
  secret: config.auth.session.secret,
  store: new SequelizeStore({
    db: sequelize
  }),
  resave: false,
  proxy: true
}));

app.use(flash());

connect-session-sequelize

Session store for connect-session using sequelize

MIT
Latest version published 26 days ago

Package Health Score

80 / 100
Full package analysis

Popular connect-session-sequelize functions

Similar packages