Commit | Line | Data |
---|---|---|
1d184b4c BA |
1 | var express = require('express'); |
2 | var router = express.Router(); | |
3 | ||
4 | const Variants = require("../variants"); | |
5 | ||
6 | // Home | |
7 | router.get('/', function(req, res, next) { | |
8 | res.render('index', { | |
982d5b66 | 9 | title: 'club', |
1d184b4c BA |
10 | variantArray: Variants, //JSON.stringify(Variants) |
11 | }); | |
12 | }); | |
13 | ||
14 | // Variant | |
15 | router.get("/:vname([a-zA-Z0-9]+)", (req,res) => { | |
16 | const vname = req.params["vname"]; | |
17 | res.render('variant', { | |
18 | title: vname + ' Variant', | |
19 | variant: vname, | |
20 | }); | |
21 | }); | |
22 | ||
23 | // Load a rules page (AJAX) | |
24 | router.get("/rules/:variant([a-zA-Z0-9]+)", (req,res) => { | |
25 | res.render("rules/" + req.params["variant"]); | |
26 | }); | |
27 | ||
28 | module.exports = router; |