Learn Node.JS Fundamental in 2022

Learn Node.JS Fundamental in 2022

 



What is Node.js?

  • Node.js is an open-source server environment
  • Node.js is free
  • Node.js runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.)
  • Node.js uses JavaScript on the server

What Can Node.js Do?

  • Node.js can generate the dynamic page content
  • Node.js can create, open, read, write, delete, and close files on the server
  • Node.js can collect form data
  • Node.js can add, delete, and modify data in your database

What is a Node.js File?

  • Node.js files contain tasks that will be executed on certain events
  • A typical event is someone trying to access a port on the server
  • Node.js files must be initiated on the server before having any effect
  • Node.js files have extension ".js"

Let's Create Our First Hello World Using Node.JS

const http = require("http");

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

    res.write("this is our first text about server");
    res.end();

});

server.listen(3000,()=>{
    console.log(`the server is running in port 3000`)
})