Updates to file structure
@@ -16,8 +16,8 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- '5432:5432'
|
- '5432:5432'
|
||||||
volumes:
|
volumes:
|
||||||
- group-project:/var/lib/postgresql/data
|
- users-database:/var/lib/postgresql/data
|
||||||
- ./init_data:/docker-entrypoint-initdb.d
|
- ./public/init_data:/docker-entrypoint-initdb.d
|
||||||
web:
|
web:
|
||||||
container_name: node-web-interface
|
container_name: node-web-interface
|
||||||
image: node:lts
|
image: node:lts
|
||||||
@@ -35,4 +35,4 @@ services:
|
|||||||
- ./node_modules:/home/node/app/node_modules # Mount node_modules directory
|
- ./node_modules:/home/node/app/node_modules # Mount node_modules directory
|
||||||
command: 'npm run start'
|
command: 'npm run start'
|
||||||
volumes:
|
volumes:
|
||||||
group-project:
|
users-database:
|
||||||
22
index.js
@@ -21,8 +21,8 @@ const moment = require('moment'); // To extract current time data
|
|||||||
// create `ExpressHandlebars` instance and configure the layouts and partials dir.
|
// create `ExpressHandlebars` instance and configure the layouts and partials dir.
|
||||||
const hbs = handlebars.create({
|
const hbs = handlebars.create({
|
||||||
extname: 'hbs',
|
extname: 'hbs',
|
||||||
layoutsDir: __dirname + '/client/src/views/layouts',
|
layoutsDir: __dirname + '/src/views/layouts',
|
||||||
partialsDir: __dirname + '/client/src/views/partials',
|
partialsDir: __dirname + '/src/views/partials',
|
||||||
});
|
});
|
||||||
|
|
||||||
// database configuration
|
// database configuration
|
||||||
@@ -53,7 +53,7 @@ db.connect()
|
|||||||
// Register `hbs` as our view engine using its bound `engine()` function.
|
// Register `hbs` as our view engine using its bound `engine()` function.
|
||||||
app.engine('hbs', hbs.engine);
|
app.engine('hbs', hbs.engine);
|
||||||
app.set('view engine', 'hbs');
|
app.set('view engine', 'hbs');
|
||||||
app.set('views', path.join(__dirname, '/client/src/views'));
|
app.set('views', path.join(__dirname, '/src/views'));
|
||||||
app.use(bodyParser.json()); // specify the usage of JSON for parsing request body.
|
app.use(bodyParser.json()); // specify the usage of JSON for parsing request body.
|
||||||
|
|
||||||
// initialize session variables
|
// initialize session variables
|
||||||
@@ -88,26 +88,26 @@ app.use(async function(req, res, next) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Serve static files from the 'public' directory
|
// Serve static files from the 'public' directory
|
||||||
app.use(express.static(path.join(__dirname, '/client/src/assets')));
|
app.use(express.static(path.join(__dirname, '/src/assets')));
|
||||||
|
|
||||||
// *****************************************************
|
// *****************************************************
|
||||||
// <!-- Section 4 : Middleware -->
|
// <!-- Section 4 : Middleware -->
|
||||||
// *****************************************************
|
// *****************************************************
|
||||||
|
|
||||||
// Middleware to automatically update live scoreboard
|
// Middleware to automatically update live scoreboard
|
||||||
const fetchMatchesData = require('./client/src/assets/middleware/navigation-bar/current-match-information');
|
const fetchMatchesData = require('./src/assets/middleware/navigation-bar/current-match-information');
|
||||||
app.use(fetchMatchesData);
|
app.use(fetchMatchesData);
|
||||||
|
|
||||||
//Middleware to automatically update in-game time abbreviations
|
//Middleware to automatically update in-game time abbreviations
|
||||||
|
|
||||||
const convert_time = require('./client/src/assets/middleware/navigation-bar/convert-time');
|
const convert_time = require('./src/assets/middleware/navigation-bar/convert-time');
|
||||||
app.use(convert_time);
|
app.use(convert_time);
|
||||||
|
|
||||||
|
|
||||||
// Leagues Page Middleware
|
// Leagues Page Middleware
|
||||||
|
|
||||||
const fetchLeaguesData = require('./client/src/assets/middleware/leagues-page/get-current-league-information');
|
const fetchLeaguesData = require('./src/assets/middleware/leagues-page/get-current-league-information');
|
||||||
const fetchLeagueScorerData = require('./client/src/assets/middleware/leagues-page/get-current-league-top-scorers');
|
const fetchLeagueScorerData = require('./src/assets/middleware/leagues-page/get-current-league-top-scorers');
|
||||||
|
|
||||||
app.get('/league/:leagueID', [fetchLeaguesData, fetchLeagueScorerData], (req, res) => {
|
app.get('/league/:leagueID', [fetchLeaguesData, fetchLeagueScorerData], (req, res) => {
|
||||||
// Render the Handlebars view with league data
|
// Render the Handlebars view with league data
|
||||||
@@ -120,7 +120,7 @@ app.get('/league/:leagueID', [fetchLeaguesData, fetchLeagueScorerData], (req, re
|
|||||||
|
|
||||||
// Clubs Page Middleware
|
// Clubs Page Middleware
|
||||||
|
|
||||||
const fetchClubsData = require('./client/src/assets/middleware/clubs-page/get-current-club-information');
|
const fetchClubsData = require('./src/assets/middleware/clubs-page/get-current-club-information');
|
||||||
|
|
||||||
app.get('/club/:clubID', [fetchClubsData], (req, res) => {
|
app.get('/club/:clubID', [fetchClubsData], (req, res) => {
|
||||||
// Render the Handlebars view with league data
|
// Render the Handlebars view with league data
|
||||||
@@ -264,7 +264,7 @@ app.get('/logout', (req, res) => {
|
|||||||
*************************/
|
*************************/
|
||||||
|
|
||||||
// Import and call generateLeagueRoutes function
|
// Import and call generateLeagueRoutes function
|
||||||
const generateLeagueRoutes = require('./client/src/assets/routes/league-pages/generate-league-routes');
|
const generateLeagueRoutes = require('./src/assets/routes/league-pages/generate-league-routes');
|
||||||
generateLeagueRoutes(app);
|
generateLeagueRoutes(app);
|
||||||
|
|
||||||
/************************
|
/************************
|
||||||
@@ -272,7 +272,7 @@ generateLeagueRoutes(app);
|
|||||||
*************************/
|
*************************/
|
||||||
|
|
||||||
// Import and call generateLeagueRoutes function
|
// Import and call generateLeagueRoutes function
|
||||||
const generateClubRoutes = require('./client/src/assets/routes/club-pages/generate-club-routes');
|
const generateClubRoutes = require('./src/assets/routes/club-pages/generate-club-routes');
|
||||||
generateClubRoutes(app);
|
generateClubRoutes(app);
|
||||||
|
|
||||||
/************************
|
/************************
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 43 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 127 KiB After Width: | Height: | Size: 127 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |
|
Before Width: | Height: | Size: 2.6 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |