user6714088 user6714088 - 1 year ago 92
Node.js Question

". Redirecting to" express

I'm currently having a hard time finding why

render :

<p>OK. Redirecting to <a href="/index">/</a></p>

Instead of a direct redirection on the page.

I looked up in the file ./node_modules/express/lib/response.js (ctrl + F ". Redirecting to") and found the line where it created this HTML code but I failed to understand why it is printed instead of the redirection I'm waiting for.
Nothing about that is written in the doc on this page

How do I get a normal redirection?

The base come from eSpress-generator

Answer Source

It doesn't render that content instead of redirecting, it renders that content in addition to redirecting.

Here Express sets the appropriate Location header and then here it sets the (default) 302 HTTP status code.