-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
32 lines (27 loc) · 905 Bytes
/
index.js
File metadata and controls
32 lines (27 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Imports
const express = require('express');
const helmet = require('helmet');
const compression = require('compression');
// My Routes
const stats = require('./routes/stats');
const sched = require('./routes/sched');
// Constants
const PORT = process.env.PORT || 5000;
const app = express();
// Set up Express securely
app.use(helmet());
app.use(compression());
// Serve pages in 'public' directory
app.use(express.static('public'));
/**
* Route to provide JSON formatted stats object with current NFL team information.
* See `./routes/stats.js` for documentation of stats schema.
*/
app.get('/stats', stats.getStats);
/**
* Route to provide JSON formatted information about next weeks NFL games.
* See `./routes/sched.js` for documentation of next schema.
*/
app.get('/sched', sched.getSched);
// Start up server
app.listen(PORT, () => console.log(`Stats app listening on port ${PORT}!`));