Port changed back to 3000
This commit is contained in:
@@ -1,18 +1,25 @@
|
||||
// create-league-routes.js
|
||||
|
||||
const express = require('express');
|
||||
const app = express();
|
||||
const exphbs = require('express-handlebars');
|
||||
|
||||
const app = express();
|
||||
|
||||
app.engine('hbs', exphbs({ extname: '.hbs' }));
|
||||
app.set('view engine', 'hbs');
|
||||
|
||||
// Define the redirectToLeaguePage function
|
||||
function redirectToLeaguePage(leagueName) {
|
||||
window.location.href = '/views/pages/league-page/league-page.hbs?leagueName=' + encodeURIComponent(leagueName);
|
||||
}
|
||||
|
||||
// Define a route to render the league-page.hbs template
|
||||
app.get('/league-page/:leagueName', (req, res) => {
|
||||
const leagueName = req.params.leagueName;
|
||||
// Here you might fetch data related to the clicked league
|
||||
// Pass the data to the template and render it
|
||||
res.render('league-page', { leagueName });
|
||||
res.render('league-page/league-page', { leagueName });
|
||||
});
|
||||
|
||||
app.listen(3000, () => {
|
||||
console.log('Server is running on http://localhost:3000');
|
||||
});
|
||||
// Export the app and redirectToLeaguePage function
|
||||
module.exports = { app, redirectToLeaguePage };
|
||||
|
||||
Reference in New Issue
Block a user