32 lines
932 B
JavaScript
32 lines
932 B
JavaScript
var express = require('express');
|
|
var router = express.Router();
|
|
var database = require('../database/database');
|
|
|
|
/* GET submit page. */
|
|
router.get('/', function(req, res, next) {
|
|
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 });
|
|
});
|
|
|
|
/* POST submit page. */
|
|
router.post('/', function(req, res, next) {
|
|
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'];
|
|
|
|
|
|
});
|
|
|
|
module.exports = router;
|