Cleanup, comments, removed ejs stuff
This commit is contained in:
@@ -5,6 +5,10 @@ const io = require('../controllers/socketio');
|
||||
const timer = require('../controllers/timer');
|
||||
const score = require('../controllers/score');
|
||||
|
||||
// ######################################################################################################################################################
|
||||
// General endpoints
|
||||
// ######################################################################################################################################################
|
||||
|
||||
// Express router endpoint to trigger a frontend refresh on all connected sockets
|
||||
router.get('/refreshMonitor', function(req, res, next) {
|
||||
console.log("Monitor neu geladen");
|
||||
@@ -13,6 +17,10 @@ router.get('/refreshMonitor', function(req, res, next) {
|
||||
res.send(); // send empty response
|
||||
});
|
||||
|
||||
// ######################################################################################################################################################
|
||||
// Timerendpoints
|
||||
// ######################################################################################################################################################
|
||||
|
||||
// Express router entpoint to start the timer
|
||||
router.get('/timerStart', function(req, res, next) {
|
||||
if(timer.start()) { // If successfully started the timer
|
||||
@@ -51,6 +59,10 @@ router.get('/timerGetValues', function(req, res, next) {
|
||||
res.json(timer.getValues()); // Respond with important values for frontend
|
||||
});
|
||||
|
||||
// ######################################################################################################################################################
|
||||
// Scoreboard endpoints
|
||||
// ######################################################################################################################################################
|
||||
|
||||
// Express router endpoint to toggle the scoreboard
|
||||
router.get('/scoreToggle', function(req, res, next) {
|
||||
if(score.getEnabled()) { // If scoreboard enabled
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
var express = require('express');
|
||||
var router = express.Router();
|
||||
let io = require('../controllers/socketio');
|
||||
const timer = require('../controllers/timer');
|
||||
const score = require('../controllers/score');
|
||||
|
||||
const score = require("../controllers/score");
|
||||
|
||||
/* GET home page. */
|
||||
router.get('/', function(req, res, next) {
|
||||
if (score.getEnabled()) { // If scoreboard is enabled
|
||||
res.render('indexScore', {
|
||||
title: "Timer and Score",
|
||||
durationLeft: timer.print(),
|
||||
});
|
||||
} else { // If scoreboard is not enabled
|
||||
res.render('index', { title: "Timer", durationLeft: timer.print()})
|
||||
}
|
||||
if (score.getEnabled()) { // If scoreboard is enabled
|
||||
res.render('indexScore', {}); // Render the site with scoreboard
|
||||
} else { // If scoreboard is not enabled
|
||||
res.render('index', {}); // Render the site without scoreboard
|
||||
}
|
||||
});
|
||||
|
||||
io.on('connection', (socket) => {
|
||||
@@ -21,9 +18,8 @@ io.on('connection', (socket) => {
|
||||
socket.emit("Hello user from server");
|
||||
|
||||
socket.on('message', (message) => {
|
||||
console.log(message)
|
||||
console.log(message)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
module.exports = router;
|
||||
|
||||
Reference in New Issue
Block a user