DEV Community

Cover image for Node JS - An Introduction
Ayaan Shaikh
Ayaan Shaikh

Posted on

Node JS - An Introduction

What is Node JS?

Going back in time, Javascript was majorly used in web browsers and was meant to add interactivity to websites. 🌐 The use of Javascript was quite limited as we couldn't directly run it on a machine.

🤔 You might be wondering what magic browsers do to run Javascript. The answer resides beneath the Javascript engines developed by various browsers to run Javascript. Google Chrome uses the V8 engine which was built in C++ to run Javascript in Chrome.

Before continuing it is important to note how we can run code on machines. The machine understands machine code which is similar to binary and is very complex to read and understand. Hence Assembly Language was introduced which provides some abstraction but it still was complex. Another layer of abstraction was done by introducing low-level programming languages like C which compiles the code to machine code and executes it.

Image explaining level of abstraction in different programming languages

Now it is more clear to us why we are not able to run Javascript directly on our machines and to solve this problem Node JS came into the picture.

👉 Node JS in simple terms is a cover around the V8 engine which allows us to execute Javascript code directly in machines. Although we are now no longer in the browser, the ability to manipulate DOM elements is lost in Node JS but instead more backend-specific features like file methods, connecting to the database, and listening for requests (acting as a server) come with it.

Now we can imagine it as a layer above the stack which helps us to convert Javascript to machine code and execute it.

Addition of Node JS to abstraction stack

Why do we need Node JS?

You might be wondering what's the point of Node JS why we want to run it on our Machine. So initially whenever we request a web page from the client side (a browser), we need a server that is capable of generating a response and to achieve the same we need to have scripts residing in the server that direct the overall logic. To write this logic on the backend we can use Node JS.

Node JS vs other Server side languages
Apart from Node JS, we can use various languages on our server like Python, GO, Ruby, PHP etc. but what makes Node JS a better option?

We do not need to learn a new language for programming the backend.

Huge amount of tools and packages to help.

Node JS has a massive community.

Node JS delivers great performance.

Conclusion

🎉 In conclusion, Node JS is a powerful tool that has revolutionized the way we write server-side code. With its ability to execute Javascript on the server, it has made it possible to write both client and server-side code in the same language. Its growing community and vast array of packages make it a popular choice among developers.

Connect With Me 🔗

Feel free to reach out if you have questions, want to share experiences or simply want to chat!

Twitter: IamAyaanSk

Top comments (1)

Collapse
 
iamayaansk profile image
Ayaan Shaikh

This is my first article on dev.
Do share your feedback in the comments and thanks for reading.