I am starting a series on node js. Actually I’m not super skilled with node js. So I thought let’s start from zero again and help others with me to learn about it. I saw the ‘the net ninja’ tutorials and took the syllabus from there and make a fusion of my own. I want to help you with my journey, let’s ride together into node js for 30 days…

Day 14 — Serving HTML Pages— Learning Node JS In 30 Days [Mini series]

A full series to learn the basics easily of node js

Muhammad Ali

--

Do you know we can send html pages to the client?

Yes! You can do it using node js.

First we’ll create the server as like day 12

For sending the html file we need the `fs module` which in built in node.

I got the starter from bootstrap — https://getbootstrap.com/docs/4.4/getting-started/introduction/

We need to create stream using fs module. So that we can send the html file.

Then we can send it using pipe and send the response.

Now run it using node app.js

See the result

Let me know if you have any questions about it.

Originally it published on nerdjfpb blog and graphical version on instagram. you can connect with me in twitter, linkedin or instagram

--

--

No responses yet