Step toward a one-page application
[vchess.git] / routes / index.js
CommitLineData
582df349
BA
1// Main index page
2
298c42e6 3let router = require("express").Router();
8d7e2786
BA
4const VariantModel = require("../models/Variant");
5const selectLanguage = require("../utils/language.js");
298c42e6
BA
6
7router.get('/', function(req, res, next) {
8d7e2786
BA
8 VariantModel.getAll((err,variants) => {
9 if (!!err)
10 return next(err);
11 res.render('index', {
8d7e2786
BA
12 variantArray: variants,
13 lang: selectLanguage(req, res),
298c42e6
BA
14 });
15 });
16});
17
18module.exports = router;