summaryrefslogtreecommitdiff
path: root/lib/web/note/router.js
diff options
context:
space:
mode:
authorSheogorath2019-11-20 20:07:35 +0100
committerGitHub2019-11-20 20:07:35 +0100
commit689f5a0a9583fdd774a271a9e6265ee5356d72a0 (patch)
tree754bed08f4724a4bc4f91743f6dfe12f92857c01 /lib/web/note/router.js
parentf894d3c2fa29865288a31cd80cd2a772ce44b330 (diff)
parentb5ccceff59002034fbb089935076f40b8aa16e58 (diff)
Merge pull request #213 from davidmehren/refactor_backend_notes
First steps in refactoring the backend code
Diffstat (limited to 'lib/web/note/router.js')
-rw-r--r--lib/web/note/router.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/web/note/router.js b/lib/web/note/router.js
new file mode 100644
index 00000000..cf6fdf43
--- /dev/null
+++ b/lib/web/note/router.js
@@ -0,0 +1,30 @@
+'use strict'
+
+const Router = require('express').Router
+const { markdownParser } = require('../utils')
+
+const router = module.exports = Router()
+
+const noteController = require('./controller')
+const slide = require('./slide')
+
+// get new note
+router.get('/new', noteController.createFromPOST)
+// post new note with content
+router.post('/new', markdownParser, noteController.createFromPOST)
+// post new note with content and alias
+router.post('/new/:noteId', markdownParser, noteController.createFromPOST)
+// get publish note
+router.get('/s/:shortid', noteController.showPublishNote)
+// publish note actions
+router.get('/s/:shortid/:action', noteController.publishNoteActions)
+// get publish slide
+router.get('/p/:shortid', slide.showPublishSlide)
+// publish slide actions
+router.get('/p/:shortid/:action', slide.publishSlideActions)
+// get note by id
+router.get('/:noteId', noteController.showNote)
+// note actions
+router.get('/:noteId/:action', noteController.doAction)
+// note actions with action id
+router.get('/:noteId/:action/:actionId', noteController.doAction)