Res.sendFile works, but my localhost:3000 does not automatically change to localhost:3000/success.html
How do get my browser to show localhost:3000/success.html when i click on Submit?
When I Click submit, it indeed serves up the "success.html" as a response when i check using the chrome dev tools, but my browser does not change the url
const express = require('express'). // Include ExpressJS
const app = express(). // Create an ExpressJS app
const bodyParser = require('body-parser'); // Middleware
const path = require("path")
app.use(bodyParser.urlencoded({ extended: false }));
// Route to Homepage
app.get('/', (req, res) => {
res.sendFile(__dirname + '/static/index.html');
});
// Route to Login Page
app.get('/login', (req, res) => {
res.sendFile(__dirname + '/static/login.html');
});
app.post('/login', (req, res) => {
// Insert Login Code Here
let username = req.body.username;
let password = req.body.password;
res.sendFile(path.join(__dirname,'success.html'));
});
const port = 3000 // Port we will listen on
// Function to listen on the port
app.listen(port, () => console.log(`This app is listening on port ${port}`));**strong text**