Your First Node.js Web Server

In this video I am going to walk you through all the steps necessary to create your very first Node.js web server. We will start at the very beginning with installing Node.js, and end with a fully functioning basic web server that serves HTML documents.

Download Node.js:

More Node.js Tutorials:




#Nodejs #WebDevelopment #WebServer

20 thoughts on “Your First Node.js Web Server

  1. const http = require('http')

    const fs = require('fs')

    const port = 3000

    const server = http.createServer(function(req, res) {

    res.writeHead(200, { 'Content-Type': 'text/html' })

    fs.readFile('index.html', function(error, data) {

    if (error) {


    res.write('Error: File not found!')

    } else{







    <!DOCTYPE html>

    <html lang="en">


    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">




    This is HTML




    but still it is not working?

    localhost has refused the connection.

Leave a Reply

Your email address will not be published. Required fields are marked *