#14 Setting headers for Response | Fundamentals of NODE JS | A Complete NODE JS Course

preview_player
Показать описание
In this lecture you will learn how to set headers for response before sending response to the client from server.

Рекомендации по теме
Комментарии
Автор

This is so amazing. Thank you so much for this series.

Bstboy
Автор

Add toString method as we need to convert html to string:

* res.end(html.toString().replace('{{%CONTENT%}}', 'This is the Home page')*

anuragh
Автор

Great, now please is it possible to get the response header set from the backend in the front end and use it,

For example, in the back, I set a header {"new-header" : "this is my new header msg"}, how can I get and use it into the front end

ulrichtech
Автор

I came up with a problem that, replace() method not working. Solved with: the content from readFileSync is returning a buffer, so that it converted to a string, and stored in a variable. Then replace can be used.

MinuteTechMallu