In Node Js route.js when user try to open
app.use('/demo1', require('express').static(__dirname + '/demo1'));
then i want to redirect to
app.use('/demo2', require('express').static(__dirname + '/demo2'));
like In the browser user type http://locahhost:5010/demo1 this URL
but it will open http://locahhost:5010/demo2 this URL
user = o; res. redirect('/home'); } else{ res. render('/login', { title: 'Hello - Please Login To Your Account' }); } }); } }); After that, all other html websites are linked from within dashboard.
redirect() function redirects to the URL derived from the specified path, with specified status, a integer (positive) which corresponds to an HTTP status code. The default status is “302 Found”.
Use redirect in your route Express redirect
Example:
app.get('/demo1', function(req, res) {
res.redirect('/demo2');
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With