Introduction to NodeJs Flashcards

1
Q

What is NodeJs??

A

NodeJs is a javascript runtime built on google’s open-source V8 javascript engine.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

REPL

A

Read-Eval-Print-Loop

it is an environment like the browser console, where we can write Js code .

We acces the REPL by taping node in the terminal

By hitting tab twice, you can see all the global variables that are available in Node.

NodeJs supports ES6 in all the newer versions out of the box without any problem.

💡 _ : previous result

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Run a file in nodeJs

A

All we do is to use our node command :

node + the name of the file you want to execute in the terminal

$ node index.html

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Modules in NodeJS

A

Node JS is build around the concept of modules where all kinds of additional functionality are stored in a module.

To use module :
-we do require them into our code.
-and then store the result of requiring function in a variable.

💡 The result is an object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

JAVASCRIPT OUTSIDE THE BROWSER

A

Every browser natively understand html, css and Javascript, no matter you use vanilla js or js framework.
In this case the browser is then the javascript runtime.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what if we could take JavaScript out of the browser and simply execute or JavaScript code somewhere else without all the restrictions that we have in the browser?

A

NodeJs is the solution that allows us to executed JS outside of the browser.It’s just another JS runtine.

It’s just like a container, like an environment, in which a program written in JS can be executed.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

who actually does execute the code if not the browser?

A

that’s where the V8 engine developed by Google comes into place.

that is exactly where JavaScript code will be parsed and run(executed) in NodeJS.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

JAVASCRIPT ON THE SERVER

A

Now that we have JS outside the browser, we can do so many good things that were completely impossible before, like aceessing the file system and networking capabilities without nodeJS.

All these factors give us the perfect conditions for using nodeJS as a web server.

We can now use JS on the server-side of web development to build fast, highly scalable network applications (backend)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

NodeJs PROS

A

Single threaded, based on event driven, non blocking I/O model

Perfect for building fast and scalable data-intensive

Js accross the entire stack

npm

very active developer community

Netflix, Uber,paypal,ebay

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Use NodeJS

A

API with database behind it(preferably NOSQL)

Data streaming

Real time chat application

Server-side web application

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

DON’T USE

A

Applications with heavy server-side processing(CPU intensive)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly