1 var express
= require('express');
2 var router
= express
.Router();
3 var createError
= require('http-errors');
5 const Variants
= require("../variants");
8 router
.get('/', function(req
, res
, next
) {
11 variantArray: Variants
, //JSON.stringify(Variants)
16 router
.get("/:vname([a-zA-Z0-9]+)", (req
,res
,next
) => {
17 const vname
= req
.params
["vname"];
18 if (!Variants
.some(v
=> { return (v
.name
== vname
); }))
19 return next(createError(404));
20 res
.render('variant', {
21 title: vname
+ ' Variant',
26 // Load a rules page (AJAX)
27 router
.get("/rules/:variant([a-zA-Z0-9]+)", (req
,res
) => {
28 res
.render("rules/" + req
.params
["variant"]);
31 module
.exports
= router
;