summaryrefslogtreecommitdiff
path: root/lib/web/historyRouter.js
diff options
context:
space:
mode:
authorBoHong Li2017-04-12 05:48:55 +0800
committerRaccoon Li2017-05-08 19:24:38 +0800
commit706df11e2356bd7548bfa14316e86111b7ba9d90 (patch)
tree592d263ec6716d763a66ac794d5cd44a23dc3934 /lib/web/historyRouter.js
parentc99ae8e1f88f53739e781d20ecfd394264208e51 (diff)
refactor(app.js): Extract history api
Diffstat (limited to 'lib/web/historyRouter.js')
-rw-r--r--lib/web/historyRouter.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/web/historyRouter.js b/lib/web/historyRouter.js
new file mode 100644
index 00000000..738e409d
--- /dev/null
+++ b/lib/web/historyRouter.js
@@ -0,0 +1,19 @@
+'use strict'
+
+const Router = require('express').Router
+
+const {urlencodedParser} = require('./utils')
+const history = require('../history.js')
+
+const historyRouter = module.exports = Router()
+
+// get history
+historyRouter.get('/history', history.historyGet)
+// post history
+historyRouter.post('/history', urlencodedParser, history.historyPost)
+// post history by note id
+historyRouter.post('/history/:noteId', urlencodedParser, history.historyPost)
+// delete history
+historyRouter.delete('/history', history.historyDelete)
+// delete history by note id
+historyRouter.delete('/history/:noteId', history.historyDelete)