Index page almost OK. Now work on variant page (main hall...)
[vchess.git] / routes / index.js
1 let router = require("express").Router();
2 const sqlite3 = require('sqlite3');//.verbose();
3 const DbPath = __dirname.replace("/routes", "/db/vchess.sqlite");
4 const db = new sqlite3.Database(DbPath);
5 const selectLanguage = require(__dirname.replace("/routes", "/utils/language.js"));
6
7 router.get('/', function(req, res, next) {
8 db.serialize(function() {
9 db.all("SELECT * FROM Variants", (err,variants) => {
10 if (!!err)
11 return next(err);
12 res.render('index', {
13 title: 'club',
14 variantArray: variants,
15 lang: selectLanguage(req, res),
16 });
17 });
18 });
19 });
20
21 module.exports = router;