This commit is contained in:
2017-01-23 03:38:59 +08:00
parent 878d9b63f6
commit f5dfeaa123
18 changed files with 403 additions and 70 deletions

View File

@ -0,0 +1,10 @@
module.exports = function () {
return function (ctx, next) {
switch (ctx.status) {
case 404:
ctx.body = '没有找到内容 - 404'
break
}
return next()
}
}

15
src/routes/main-routes.js Normal file
View File

@ -0,0 +1,15 @@
import KoaRouter from 'koa-router'
// import controllers from '../controllers/index.js'
const router = new KoaRouter()
router
.get('/', function (ctx, next) {
ctx.body = '禁止访问!'
}) // HOME 路由
// .get('/api/:api_type/:name', controllers.api.api_get)
// .put('/api/:api_type/:name', controllers.api_put.api_put
// .post('/api/:api_type/:name', controllers.api.default)
// .delect('/api/:api_type/:name', controllers.api.default)
module.exports = router