refactor: export

This commit is contained in:
xiaojunnuo
2021-02-09 18:05:01 +08:00
parent a9b6e87249
commit c3e374e6e5
8 changed files with 52 additions and 23 deletions

View File

@@ -8,6 +8,7 @@ import fs from 'fs'
import _ from 'lodash-es'
import './install.js'
import pathUtil from './utils/util.path.js'
import compress from 'koa-compress'
const app = new Koa()
// error handler
@@ -21,10 +22,14 @@ app.use(json())
app.use(logger())
const staticPlugin = Static(pathUtil.join('public'), {
maxage: 30 * 24 * 60 * 3600
maxage: 30 * 24 * 60 * 3600,
gzip: true
})
app.use(staticPlugin)
// gzip
app.use(compress({ threshold: 2048 }))
// logger
app.use(async (ctx, next) => {
const start = new Date()