How to use the errorhandler.title function in errorhandler

To help you get started, we’ve selected a few errorhandler 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 CloudTask / cloudtask-web / src / server / index.js View on Github external
//     error.statusCode = 401;
//     return next(error);
//   }
// });

app.use('/', express.static('dist/client'));
app.use('/api/users', require('./routers/user'));
app.use('/api/dashboard', require('./routers/dashboard'));
app.use('/api/group', require('./routers/group'));
app.use('/api/location', require('./routers/location'));
app.use('/api/job', require('./routers/job'));
app.use('/api/file', require('./routers/file'));
app.use('/api/log', require('./routers/log'));
// app.use('/api/sysconfig', require('./routers/sysconfig'));

errorHandler.title = `Cloudtask WebSite`;
app.use(errorHandler({ log: false }));

user.initAdmin()
  .then(() => {
    app.listen(config.listenPort, () => {
      console.log(`Humpback Website is started on port ${config.listenPort}`);
    });
  })
  .catch(err => {
    console.log(`System init failed. Error: ${err}`);
    process.exit(-101);
  });


  // app.listen(config.listenPort, () => {
  //   console.log(`Website is started on port ${config.listenPort}`);
github bkimminich / juice-shop / server.js View on Github external
error = null
      }
      cb(error, './frontend/dist/frontend/assets/public/images/uploads/')
    },
    filename: (req, file, cb) => {
      const name = insecurity.sanitizeFilename(file.originalname)
        .toLowerCase()
        .split(' ')
        .join('-')
      const ext = mimeTypeMap[file.mimetype]
      cb(null, name + '-' + Date.now() + '.' + ext)
    }
  })
})

errorhandler.title = `${config.get('application.name')} (Express ${utils.version('express')})`

/* Locals */
app.locals.captchaId = 0
app.locals.captchaReqId = 1
app.locals.captchaBypassReqTimes = []
app.locals.abused_ssti_bug = false
app.locals.abused_ssrf_bug = false

/* Compression for all requests */
app.use(compression())

/* Bludgeon solution for possible CORS problems: Allow everything! */
app.options('*', cors())
app.use(cors())

/* Security middleware */
github humpback / humpback-web / src / server / index.js View on Github external
return next();
  } else {
    error = new Error('UnAuthorization. Not login.');
    error.statusCode = 401;
    return next(error);
  }
});

app.use('/api/users', require('./routers/user'));
app.use('/api/groups', require('./routers/group'));
app.use('/api/images', require('./routers/imageInfo'));
app.use('/api/logs', require('./routers/log'));
app.use('/api/system-config', require('./routers/systemConfig'));
app.use('/api/dashboard', require('./routers/dashboard'));

errorHandler.title = `Humpback WebSite - ${config.version}`;
app.use(errorHandler({ log: false }));

console.debug('Init system...');
user.initAdmin()
  .then(() => {
    app.listen(config.listenPort, () => {
      console.debug('Init system succeed');
      console.log(`Humpback Website is started on port ${config.listenPort}`);
    });
  })
  .catch(err => {
    console.log(`System init failed. Error: ${err}`);
    process.exit(-101);
  });
github jaystack / jaydata / odata-server / index.js View on Github external
var errorHandlerFn = function(err, req, res, next){
        if (config.errorHandler){
            errorHandler.title = typeof config.errorHandler == 'string' ?  config.errorHandler : config.provider.databaseName;
            errorHandler()(err, req, res, next);
        }else next(err);
    };
github 60frames / react-boilerplate / server / index.js View on Github external
app.set('port', process.env.PORT);

app.use(compression());

app.use('/api', api);

if (process.env.WEBPACK_DEV_SERVER === 'true') {
  app.use(require('./routes/webpack'));
} else {
  app.use(require('./routes/static'));
}

if (process.env.NODE_ENV === 'development') {
  const errorhandler = require('errorhandler');
  errorhandler.title = '¯\\_(ツ)_/¯';
  app.use(errorhandler());
}

app.listen(app.get('port'), () => {
  debug(colors.white(`Server started: http://localhost:${app.get('port')}`));
  debug(colors.grey("Press 'ctrl + c' to terminate server"));
});

errorhandler

Development-only error handler middleware

MIT
Latest version published 5 years ago

Package Health Score

76 / 100
Full package analysis

Similar packages