[Nodejs] 16. koa2环境搭建—–目录和文件介绍
入口文件:app.js,代码如下
const Koa = require('koa')
const app = new Koa()
const views = require('koa-views')
const json = require('koa-json')
const onerror = require('koa-onerror')
const bodyparser = require('koa-bodyparser')
const logger = require('koa-logger')
const index = require('./routes/index')
const users = require('./routes/users')
// error handler 错误处理器
onerror(app)
// middlewares 中间件 (app.use(...))
a
共有 0 条评论