2021-09-30 20:49:44 +00:00
|
|
|
var express = require('express');
|
|
|
|
var router = express.Router();
|
2021-11-20 23:51:08 +00:00
|
|
|
var database = require('../database/database');
|
2021-09-30 20:49:44 +00:00
|
|
|
|
|
|
|
/* GET submit page. */
|
|
|
|
router.get('/', function(req, res, next) {
|
2021-11-20 23:51:08 +00:00
|
|
|
const date_ob = new Date();
|
|
|
|
const date = ("0" + date_ob.getDate()).slice(-2);
|
|
|
|
const month = ("0" + (date_ob.getMonth() + 1)).slice(-2);
|
|
|
|
const year = date_ob.getFullYear();
|
|
|
|
|
|
|
|
const currentDate = year + '-' + month + '-' + date;
|
|
|
|
res.render('submit', { title: 'Submit Score', date: currentDate });
|
2021-09-30 20:55:01 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
/* POST submit page. */
|
|
|
|
router.post('/', function(req, res, next) {
|
2021-11-20 23:51:08 +00:00
|
|
|
const year = req.body['year'];
|
|
|
|
const sport = req.body['sport'];
|
|
|
|
const gender = req.body['gender'];
|
|
|
|
const division = req.body['division'];
|
|
|
|
const date = req.body['date'];
|
|
|
|
const team1 = req.body['team1'];
|
|
|
|
const team1Score = req.body['team1-score'];
|
|
|
|
const team2 = req.body['team2'];
|
|
|
|
const team2Score = req.body['team2-score'];
|
2021-10-04 03:50:55 +00:00
|
|
|
|
|
|
|
|
2021-09-30 20:49:44 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = router;
|