The frontend/UI server, written in JS using the MarkoJS library
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
638 B

6 years ago
6 years ago
  1. const express = require("express")
  2. const router = express.Router()
  3. const common = require("./common")
  4. const {storyApi} = require("../../rpdata/api/Story")
  5. const {Tag} = require("../../rpdata/api/Tag")
  6. const listTemplate = require("../../marko/page/story/list.marko")
  7. router.get("/:tagkind/:tagname", common, async(req, res) => {
  8. try {
  9. const tag = new Tag(req.params.tagkind, req.params.tagname)
  10. res.markoAsync(listTemplate, {
  11. stories: storyApi.list({tags: [tag]}),
  12. menuTags: [tag],
  13. selected: {tag: `${tag.kind}:${tag.name}`},
  14. })
  15. } catch(err) {
  16. console.error(err)
  17. }
  18. })
  19. module.exports = router