summaryrefslogtreecommitdiff
path: root/lib/web/note/router.js
diff options
context:
space:
mode:
authorDavid Mehren2019-10-27 13:51:53 +0100
committerDavid Mehren2019-10-27 13:51:53 +0100
commitf78540c3fbf109d6ccf2d92c5b1cf0148c88f722 (patch)
tree7f8b968b925b8b262cca0f4cd180027abc4b745e /lib/web/note/router.js
parent20a67e3446723231961043bffeb5a7b974e891c0 (diff)
Move note actions to their own file.
Because of circular import problems, this commit also moves the error messages from response.js to errors.js Signed-off-by: David Mehren <dmehren1@gmail.com>
Diffstat (limited to '')
-rw-r--r--lib/web/note/router.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/web/note/router.js b/lib/web/note/router.js
new file mode 100644
index 00000000..e23b7f64
--- /dev/null
+++ b/lib/web/note/router.js
@@ -0,0 +1,32 @@
+'use strict'
+
+const Router = require('express').Router
+
+const response = require('../../response')
+
+const { markdownParser } = require('../utils')
+
+const router = module.exports = Router()
+
+const noteActions = require('./actions')
+
+// get new note
+router.get('/new', response.postNote)
+// post new note with content
+router.post('/new', markdownParser, response.postNote)
+// post new note with content and alias
+router.post('/new/:noteId', markdownParser, response.postNote)
+// get publish note
+router.get('/s/:shortid', response.showPublishNote)
+// publish note actions
+router.get('/s/:shortid/:action', response.publishNoteActions)
+// get publish slide
+router.get('/p/:shortid', response.showPublishSlide)
+// publish slide actions
+router.get('/p/:shortid/:action', response.publishSlideActions)
+// get note by id
+router.get('/:noteId', response.showNote)
+// note actions
+router.get('/:noteId/:action', noteActions.doAction)
+// note actions with action id
+router.get('/:noteId/:action/:actionId', noteActions.doAction)