DEV Community

Khushi
Khushi

Posted on

Node JS Intro

Node allows us to run JavaScript on the server side or directly on computers locally. A computer cannot directly understand JavaScript but it could be understood by the V8 engine in a browser. Node JS is written in C++. It can take JavaScript and run it to the V8 engine that is present in Node JS and compile it to the machine code.

It adds more functionality to the JavaScript➖

→ Read and write files on the computer

→ Connect to a database

→ Act as a server for content

but we can’t interact with DOM in Nodejs and Node JS doesn't support ES6 import directly.

Role of the Nodejs

Handling requests coming from the browser. Suppose a user might interact with your website and that browser sends a request to the server. Node JS will react to those requests, it might communicate with databases or files on a server and give a response to it, it could be an Html page embedded with data, image files, etc.

Why use Nodejs?

→ No need to learn an extra language for the server

→ can share code between front and backend

→ Nodejs has a massive community behind it

→ Huge amount of third-party packages and tools to help

after installing open any text editor

create a file text.js and type

const name = “Star”

console.log(name)
Enter fullscreen mode Exit fullscreen mode

Now write in terminal “node text” and Enter

Your file will run

if you want to check the version of your node type

node -v

Here it is! node JS running in your system.

Reference : net ninja(YouTube)

Top comments (2)

Collapse
 
abhinandan__wadhwa profile image
Abhinandan Wadhwa • Edited

Amazing blog on Node basics🔥

Collapse
 
ericabrookssf profile image
Erica Brooks

i agree very useful blog post