Added db with team selection, scoreboard enabled by default, Added Debugwindow, cleanup
This commit is contained in:
@@ -4,6 +4,7 @@ const io = require('../controllers/socketio');
|
||||
|
||||
const timer = require('../controllers/timer');
|
||||
const score = require('../controllers/score');
|
||||
const db = require('../controllers/db');
|
||||
|
||||
// ######################################################################################################################################################
|
||||
// General endpoints
|
||||
@@ -123,6 +124,27 @@ router.post('/scoreConfigTeams', function(req, res, next) {
|
||||
res.json(score.getValues());
|
||||
});
|
||||
|
||||
// ######################################################################################################################################################
|
||||
// DB endpoints
|
||||
// ######################################################################################################################################################
|
||||
|
||||
// Express router endpoint to get important values for db contents
|
||||
router.get('/dbGetValues', function(req, res, next) {
|
||||
res.json(db.getValues()); // Respond with important values for frontend
|
||||
});
|
||||
|
||||
// Express router endpoint to add a team to the team database
|
||||
router.post('/dbAddTeam', function(req, res, next) {
|
||||
db.addTeam(req.body.teamName); // Add teamname to DB
|
||||
res.json(db.getValues()); // Respond with all important values to update the frontend
|
||||
});
|
||||
|
||||
// Express router endpoint to delete a team from the team database
|
||||
router.post('/dbDeleteTeam', function(req, res, next) {
|
||||
db.deleteTeam(req.body.teamName); // Add teamname to DB
|
||||
res.json(db.getValues()); // Respond with all important values to update the frontend
|
||||
});
|
||||
|
||||
/* GET home page. */
|
||||
router.get('/', function(req, res, next) {
|
||||
res.render('admin');
|
||||
|
||||
Reference in New Issue
Block a user