What exactly is Node.js?

What exactly is Node.js?

Node.js is a JavaScript runtime environment that includes everything you need to execute a program written in JavaScript. It converts your JavaScript code into machine code and converts it into a faster machine code. Sounds great, but what does that mean? How does that work? The Node run-time environment includes everything

The JavaScript runtime built on Chrome’s V8 JavaScript engine

Blocking I/O

In the blocking method, user2’s data request is not initiated until user1’s data is printed to the screen.

V8 turbo-charges JavaScript by leveraging C++

V8 is an open source runtime engine written in C++ that can run standalone or embedded into any C++ application

Non-blocking I/O

A non-blocking request allows you to initiate a data request for user2 without waiting for the response from user1.

Writing Hello World in Node.js

Make a file app.js.

The JavaScript event loop

Push main(), setTimeout(2000), and console.log() onto the call stack, then push setTimeout (2000) onto the stack.

Require

Loads modules that come bundled with Node.js, and third-party libraries like Express and Mongoose that you install from npm

Source

Get in