在项目目录下新建一个 views 文件夹,存放页面:
app.js 里配置 art-template 模板引擎,渲染页面:
路由配置文件渲染相关页面:(以views 为根目录)
//用户管理的crud const router = require('koa-router')() router.get('/', async (ctx) => { ctx.body = "app/后台管理/新闻管理首页" }) router.get('/add', async (ctx) => { await ctx.render('admin/news/add') }) router.get('/update', async (ctx) => { await ctx.render('admin/news/update') }) router.get('/delete', async (ctx) => { await ctx.render('admin/news/delete') }) module.exports = router;