mirror of
https://github.com/certd/certd.git
synced 2025-11-25 09:10:11 +08:00
refactor: logo
This commit is contained in:
@@ -7,6 +7,7 @@ import Static from 'koa-static'
|
||||
import fs from 'fs'
|
||||
import _ from 'lodash-es'
|
||||
import './install.js'
|
||||
import pathUtil from './utils/util.path.js'
|
||||
const app = new Koa()
|
||||
|
||||
// error handler
|
||||
@@ -19,7 +20,10 @@ app.use(bodyparser({
|
||||
app.use(json())
|
||||
app.use(logger())
|
||||
|
||||
app.use(Static(new URL('public', import.meta.url).pathname))
|
||||
const staticPlugin = Static(pathUtil.join('public'), {
|
||||
maxage: 30 * 24 * 60 * 3600
|
||||
})
|
||||
app.use(staticPlugin)
|
||||
|
||||
// logger
|
||||
app.use(async (ctx, next) => {
|
||||
@@ -29,8 +33,6 @@ app.use(async (ctx, next) => {
|
||||
console.log(`${ctx.method} ${ctx.url} - ${ms}ms`)
|
||||
})
|
||||
|
||||
console.log('url', import.meta.url)
|
||||
|
||||
// routes
|
||||
const files = fs.readdirSync(new URL('controllers/', import.meta.url))
|
||||
// 过滤出.js文件:
|
||||
|
||||
Reference in New Issue
Block a user