Node.js Flashcards

1
Q

What is Node.js?

A

program that allows JavaScript to be run outside of a web browser.

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

What can Node.js be used for?

A

used for traditional web sites and back-end API services, but was designed with real-time, push-based architectures in mind

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

What is a REPL?

A

Read-eval-print loop
Interactive computer programming environment that takes a single user input, executes them, and returns the result to the user

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

When was Node.js created?

A

May 27, 2009

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

What back end languages have you heard of?

A

Ruby
Python
PHP

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

What is a computer process?

A

The instance of a computer program that is being executed by one or many threads

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

Roughly how many computer processes are running on your host operating system (Task Manager or Activity Monitor)?

A

50+

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

Why should a full stack Web developer know that computer processes exist?

A

Full stack Web development is based on making multiple processes work together to form one application, so having at least an awareness of computer processes is necessary

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

What is the process object in a Node.js program?

A

is a global that provides information about, and control over, the current Node.js process

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

How do you access the process object in a Node.js program?

A

just use the process variable (it’s global)

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

What is the data type of process.argv in Node.js?

A

Array of strings

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

What is a JavaScript module?

A

a javascript file

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

What values are passed into a Node.js module’s local scope?

A

exports, require()

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

Give two examples of truly global variables in a Node.js program.

A

process, global

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

What is a directory?

A

is a special type of file that holds information about more directories and files

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

What is a relative file path?

A

a file relative to the current page

17
Q

What is an absolute file path?

A

Any path that starts with a slash

18
Q

What module does Node.js include for manipulating the file system?

A

We include the fs module

19
Q

What method is available in the Node.js fs module for writing data to a file?

A

Node fs.writeFile

20
Q

Are file operations using the fs module synchronous or asynchronous?

A

All the operations can be performed in a synchronous as well as in an asynchronous approach depending on the user requirements.

21
Q

What is NPM?

A

a package manager for JavaScript: website, command line interface, and registry: shared data and packages, etc.
Node Package Manager

22
Q

What is a package?

A

a folder containing a package.json program that lists the your projects dependencies
specifies versions of packages
makes your build reproducible, to share with other devs (directory with one or more files, and a package.json file)

23
Q

How can you create a package.json with npm?

A

use the npm init command in the root directory of package

24
Q

What is a dependency and how do you add one to a package?

A

packages that your project depends on,

you can list them as “dependencies” in package.json

25
Q

What happens when you add a dependency to a package with npm?

A

the project will install all listed dependencies with the install command

26
Q

How do you add express to your package dependencies?

A

npm install express automatically updates list of dependencies

27
Q

What Express application method starts the server and binds it to a network PORT?

A

.listen()