how to render a new page in node js through express
// Step 1: Import required modules
const express = require('express');
// Step 2: Create an instance of Express
const app = express();
// Step 3: Set up a route to render a new page
app.get('/new-page', (req, res) => {
// Step 4: Render the 'new-page' view (assuming you have a 'views' folder with your templates)
res.render('new-page');
});
// Step 5: Set up the server to listen on a specific port
const PORT = 3000;
app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}`);
});