Fix challenges retrieval from server
[vchess.git] / server / routes / variants.js
CommitLineData
625022fd
BA
1// Get variants list (always needed)
2
3let router = require("express").Router();
4const createError = require('http-errors');
5const VariantModel = require("../models/Variant");
6const access = require("../utils/access");
7
8router.get('/variants', access.ajax, function(req, res, next) {
9 VariantModel.getAll((err,variants) => {
10 if (!!err)
11 return next(err);
12 res.json({variantArray:variants});
13 });
14});
15
16module.exports = router;