Welcome to the Treehouse Community
Looking to learn something new?
Dev DFront End Web Development Techdegree Student 406 Points
I did not understand what res.render does and why we use it
Wiktor Bednarz18,635 Points
Hey there D,
in short the .render() method on response object sends the selected view with the response to the client. The method itself takes three paramaters, from which only the 'view' parameter is required - this is the parameter that defines in case of the courses avaible on Treehouse a pug template you want to present with the response.
Without this method being called, the user wouldn't get any content to actually see after sending a request to the server.
More detailed information on this is avaible in express API docs: https://expressjs.com/en/api.html#res.render
Hope this helps,