Koa学习1:初始化项目( 二 )


// 导入Koaconst Koa = require('koa');// 导入环节变量const { APP_PORT } = require('./src/config/config.default');// 实例化const app = new Koa();// 中间件app.use(async (ctx, next) => {const start = Date.now();await next();ctx.body = 'hellow koa1';});// 监听端口app.listen(APP_PORT, () => {console.log(`app listening at http://localhost${APP_PORT}`);});