Start script to fetch data from server

main
sudoer777 2021-11-21 14:37:35 -07:00
parent 78136df5fd
commit 8c3ffcc5fa
5 changed files with 17 additions and 1 deletions

4
app.js
View File

@ -6,7 +6,8 @@ var logger = require('morgan');
var indexRouter = require('./routes/index');
var usersRouter = require('./routes/users');
var submitRouter = require('./routes/submit')
var submitRouter = require('./routes/submit');
var dataRouter = require('./routes/data');
var app = express();
@ -23,6 +24,7 @@ app.use(express.static(path.join(__dirname, 'public')));
app.use('/', indexRouter);
app.use('/users', usersRouter);
app.use('/submit', submitRouter);
app.use('/data', dataRouter);
// catch 404 and forward to error handler
app.use(function(req, res, next) {

View File

10
routes/data.js 100644
View File

@ -0,0 +1,10 @@
var express = require('express');
var router = express.Router();
var database = require('../database/database');
/* GET submit page. */
router.get('/', function(req, res, next) {
res.json( { message : "test" });
});
module.exports = router;

View File

@ -7,3 +7,4 @@ html
block stylesheets
body
block content
block scripts

View File

@ -39,3 +39,6 @@ block content
input(class="score-input", type="number", name="team2-score", value="0")
span(class='form-section')
button(type="submit") Submit
block scripts
script(src='/scripts/submit.js')