Render function

Instead of render function why can’t we send directly the html file through res.send(), here also our motive of not running javascript on the browser rather sending the html file from the server is also full filled.

Also at some places in the webinar shows redriect status as 304 whereas in my browser it is showing 302 so what’s difference between them??

res.send() is used to render the provided template file, and send the resulting html.
You can send html file directly by either using express.static middleware, or simply res.sendFile() method. This has nothing related to running js on browser. The served file (rendered or direct html) can have script tags which loads js files separately and runs in browser.

The HTTP 304 Not Modified client redirection response code indicates that there is no need to retransmit the requested resources. It is an implicit redirection to a cached resource. This happens when the request method is safe, like a GET or a HEAD request, or when the request is conditional and uses a If-None-Match or a If-Modified-Since header.

The HyperText Transfer Protocol (HTTP) 302 Found redirect status response code indicates that the resource requested has been temporarily moved to the URL given by the Location header. A browser redirects to this page but search engines don’t update their links to the resource.