How to use morgan-body - 2 common examples

To help you get started, we’ve selected a few morgan-body 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 mjrode / WhatToWatch / server / index.js View on Github external
const create = config => {
    // Server settings
    server.set('env', config.env);
    server.set('port', config.server.port);
    server.set('hostname', config.server.hostname);

    // Returns middleware that parses json
    server.use(json());
    server.use(urlencoded({ extended: true }));
    morganBody(server, {
      stream: winston.stream,
    });

    server.use(
      cookieSession({
        maxAge: 30 * 24 * 60 * 60 * 1000,
        keys: [keys.server.cookieKey],
      }),
    );
    server.use(cookieParser(keys.server.cookieKey));
    server.use(passport.initialize());
    server.use(passport.session());

    // Set up routes
    server.use('/api/plex', plex);
    server.use('/api/tdaw', tdaw);
github mozilla-sensorweb / sensorthings / src / sensorthings.js View on Github external
module.exports = (config) => {
  if (!config || !config.db) {
    throw new Error('Missing or malformed config');
  }

  const version = config.api_version || API_VERSION;

  db(config.db);

  let router = express.Router();

  if (process.env.NODE_DEBUG === 'morgan') {
    logger(router);
  }

  router.use('/' + version + '/', baseRouter);

  const routeExpr = route.generate(version);
  router.use(routeExpr, associations(version));
  router.use(routeExpr, queryParser);

  Object.keys(entities).forEach(endpoint => {
    router.use(route.generate(version, endpoint),
               require('./routes/' + snake(endpoint))(version));
  });
  router.use('/' + version + '/' + createObservations,
             dataArrayRouter(version));

  return router;

morgan-body

morgan logging req, res, and body

MIT
Latest version published 1 year ago

Package Health Score

57 / 100
Full package analysis

Popular morgan-body functions