|
|
|
@ -16,6 +16,7 @@ const rlog = require('./middleware/request_log');
|
|
|
|
|
|
|
|
|
|
// error handler
|
|
|
|
|
onerror(app)
|
|
|
|
|
// app.proxy = true;
|
|
|
|
|
app.use(log4js);
|
|
|
|
|
// middlewares
|
|
|
|
|
app.use(bodyparser({
|
|
|
|
@ -34,13 +35,13 @@ app.use(views(__dirname + '/views', {
|
|
|
|
|
|
|
|
|
|
app.use(rlog);
|
|
|
|
|
|
|
|
|
|
// logger
|
|
|
|
|
app.use(async (ctx, next) => {
|
|
|
|
|
const start = new Date()
|
|
|
|
|
await next()
|
|
|
|
|
const ms = new Date() - start
|
|
|
|
|
console.log(`${ctx.method} ${ctx.url} - ${ms}ms`)
|
|
|
|
|
})
|
|
|
|
|
// logger debug:
|
|
|
|
|
// app.use(async (ctx, next) => {
|
|
|
|
|
// const start = new Date()
|
|
|
|
|
// await next()
|
|
|
|
|
// const ms = new Date() - start
|
|
|
|
|
// console.log(`${ctx.method} ${ctx.url} - ${ms}ms`)
|
|
|
|
|
// })
|
|
|
|
|
|
|
|
|
|
// schedule jobs
|
|
|
|
|
// syncAids();
|
|
|
|
|