Node.js Flashcards
What is Node.js?
a program that allows JavaScript to be run outside of a web browser
What can Node.js be used for?
building back ends for web applications, command-line programs, or any kind of automation that developers wish to perform
What is a REPL?
Read-Evaluate-Print-Loop : a simple interactive computer programming environment that takes single user inputs, executes them, and returns the result to the user (e.g: dev tools console, node REPL)
What is a computer process?
the instance of a computer program that is being executed by one or many threads - contains the programs code and activity
(a running instance of a computer program)
Why should a full stack Web Developer know that computer processes exist?
full stack web development is based on making multiple processes work together to form one application.
- some apps are made of multiple components such as clients, servers, and databases
What is the process object in a Node.js program?
a global object that provides information about, and control over, the current Node.js process
How do you access the process object in a Node.js program?
as a global object, it’s always available to Node.js applications.
What is the data type of process.argv in Node.js?
returns an Array of strings ( containing the command-line arguments passed when the Node.js process was launched)
What is a JavaScript Module?
a single .js file
What values are passed into a Node.js module’s local scope?
exports, require, module, __filename, __dirname
Give two examples of truly global variables in a Node.js program:
- process
- global
What is a directory?
a special type of file that lists other files
What is a relative file path?
a file path relative to the current directory
What is an absolute file path?
the path to a file starting at the root
What module does Node.js include for manipulating the file system?
the fs module
what method is available in the Node.js fs module for writing data to a file?
fs.writeFile( )
Are file operators using the fs module synchronous or asynchronous?
yes. both