Changes to try and get league infromation in. Still a work in progress
This commit is contained in:
@@ -84,25 +84,24 @@ app.use(express.static(path.join(__dirname, 'resources')));
|
||||
// Importing middleware
|
||||
const fetchMatchesData = require('./resources/routes/navigation-bar/current-match-information');
|
||||
const convert_time = require('./resources/js/navigation-bar/scoreboard-header/convert-time');
|
||||
const fetchLeaguesData = require('./resources/routes/league-pages/get-current-league-information');
|
||||
|
||||
// Using middleware
|
||||
app.use(fetchMatchesData);
|
||||
app.use(convert_time);
|
||||
app.use(fetchLeaguesData);
|
||||
|
||||
// Middleware function to fetch leagues data
|
||||
const fetchLeaguesData = require('./resources/routes/league-pages/get-current-league-information');
|
||||
|
||||
// Define the route for fetching league data
|
||||
app.get('/league/:leagueID', fetchLeaguesData, (req, res) => {
|
||||
// Handle the response here
|
||||
res.json(res.locals.leagues);
|
||||
});
|
||||
|
||||
// *****************************************************
|
||||
// <!-- Section 5 : API Routes -->
|
||||
// *****************************************************
|
||||
|
||||
/************************
|
||||
League Page Routes
|
||||
*************************/
|
||||
|
||||
// Import and call generateLeagueRoutes function
|
||||
const generateLeagueRoutes = require('./resources/routes/league-pages/generate-league-routes');
|
||||
generateLeagueRoutes(app);
|
||||
|
||||
/************************
|
||||
Login Page Routes
|
||||
*************************/
|
||||
@@ -187,6 +186,14 @@ app.get('/home', (req, res) => {
|
||||
res.render('pages/home');
|
||||
});
|
||||
|
||||
/************************
|
||||
League Page Routes
|
||||
*************************/
|
||||
|
||||
// Import and call generateLeagueRoutes function
|
||||
const generateLeagueRoutes = require('./resources/routes/league-pages/generate-league-routes');
|
||||
generateLeagueRoutes(app);
|
||||
|
||||
// *****************************************************
|
||||
// <!-- Section 5 : Start Server-->
|
||||
// *****************************************************
|
||||
|
||||
Reference in New Issue
Block a user