How to use forest-express-mongoose - 2 common examples

To help you get started, we’ve selected a few forest-express-mongoose 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 Christilut / node-modern-boilerplate / config / forestadmin.ts View on Github external
module.exports = function (expressApp) {
  if ((!env.FOREST_AUTH_SECRET || !env.FOREST_ENV_SECRET) && env.NODE_ENV !== env.Environments.Test) {
    console.log('Forest Admin:\t\tMissing credentials, not loading')
    return
  }

  if (env.NODE_ENV === env.Environments.Test) {
    // console.log('Forest Admin: Not loading outside production environment')
  } else {
    expressApp.use(require('forest-express-mongoose').init({
      envSecret: env.FOREST_ENV_SECRET,
      authSecret: env.FOREST_AUTH_SECRET,
      mongoose: require('mongoose')
    }))

    // require('./forest/actions/user')

    console.log('Forest Admin:\t\tLoaded')
  }
}
github Fueled / Rover / app.js View on Github external
}));
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
app.use(expressValidator());
app.use(session({
  resave: true,
  saveUninitialized: true,
  secret: process.env.SESSION_SECRET,
  cookie: { maxAge: 1209600000 }, // two weeks in milliseconds
  store: new MongoStore({
    url: process.env.MONGODB_URI,
    autoReconnect: true,
  })
}));
app.use(require('forest-express-mongoose').init({
  modelsDir: __dirname + '/models',
  envSecret: process.env.FOREST_ENV_SECRET,
  authSecret: process.env.FOREST_AUTH_SECRET,
  mongoose: require('mongoose')
}));
app.use(passport.initialize());
app.use(passport.session());
app.use(flash());
app.use((req, res, next) => {
  lusca.csrf()(req, res, next);
});
app.use(lusca.xframe('SAMEORIGIN'));
app.use(lusca.xssProtection(true));
app.disable('x-powered-by');
app.use((req, res, next) => {
  res.locals.user = req.user;

forest-express-mongoose

Official Express/Mongoose Liana for Forest

GPL-3.0
Latest version published 10 days ago

Package Health Score

76 / 100
Full package analysis

Popular forest-express-mongoose functions