res.redirect() do in Express?res.redirect() sends a response to the browser telling it to go to a different URL. It makes the browser load a new page.
res.redirect()?Use res.redirect('/'). This tells the browser to go to the root page of the website.
res.redirect() use by default?By default, res.redirect() uses status code 302, which means "Found" or temporary redirect.
res.redirect()?Pass the status code 301 as the first argument, then the URL: res.redirect(301, '/new-url'). This tells browsers the redirect is permanent.
res.redirect() redirect to an external website?Yes, you can redirect to any URL, including external sites like res.redirect('https://example.com').
res.redirect() in Express?The default status code for res.redirect() is 302, which means a temporary redirect.
Use res.redirect(301, '/dashboard') to send a permanent redirect.
Redirect URLs must be full URLs for external sites, like https://google.com.
res.redirect() in your route handler?res.redirect() sends the redirect response and ends the request-response cycle.
The correct method is res.redirect().
res.redirect() to send a temporary and a permanent redirect in Express.res.redirect('/home') is called.