v0.0.2
This commit is contained in:
10
src/routes/error-routes.js
Normal file
10
src/routes/error-routes.js
Normal 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
15
src/routes/main-routes.js
Normal 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
|
Reference in New Issue
Block a user