Add true repetition detection
[vchess.git] / routes / all.js
CommitLineData
1d184b4c
BA
1var express = require('express');
2var router = express.Router();
3
4const Variants = require("../variants");
5
6// Home
7router.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
15router.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)
24router.get("/rules/:variant([a-zA-Z0-9]+)", (req,res) => {
25 res.render("rules/" + req.params["variant"]);
26});
27
28module.exports = router;