When attempting to send an HTML file as a response, I am experiencing an issue where the current URL is being maintained. Despite my attempts to use the location
method, it does not seem to work. Ideally, I would like the functionality to redirect to a new URL after sending the response.
The original URL in question is: localhost/login
This is the desired outcome:
res.location('/live').sendFile(path.join(__dirname, "../pages/live.html"));
I have been striving for this result:
- Desired URL in browser:
localhost/live
- Displaying the rendered HTML file
Is there an error in the way I am approaching this? Any advice would be greatly appreciated.