summaryrefslogtreecommitdiff
path: root/lib/web
diff options
context:
space:
mode:
authorBoHong Li2017-04-12 05:38:54 +0800
committerRaccoon Li2017-05-08 19:24:37 +0800
commit66c68254b4c213fcfc03ce081c47d24bcd42bbd3 (patch)
tree229449b4aa8a297ccc3017ebccc134fa230d3054 /lib/web
parent9f1f16c8e347f2bb2c0c6ab1b71c1a683a413a90 (diff)
refactor(app.js): Extract index, 403, 404, 500 pages
Diffstat (limited to '')
-rw-r--r--lib/web/baseRouter.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/web/baseRouter.js b/lib/web/baseRouter.js
new file mode 100644
index 00000000..271568b9
--- /dev/null
+++ b/lib/web/baseRouter.js
@@ -0,0 +1,23 @@
+'use strict'
+
+const Router = require('express').Router
+
+const response = require('../response')
+
+const baseRouter = module.exports = Router()
+
+// get index
+baseRouter.get('/', response.showIndex)
+// get 403 forbidden
+baseRouter.get('/403', function (req, res) {
+ response.errorForbidden(res)
+})
+// get 404 not found
+baseRouter.get('/404', function (req, res) {
+ response.errorNotFound(res)
+})
+// get 500 internal error
+baseRouter.get('/500', function (req, res) {
+ response.errorInternalError(res)
+})
+