Node.js Flashcards
What is Node.js?
Node.js is an open-source, cross-platform, back-end JavaScript runtime environment that runs on the V8 engine and executes JavaScript code outside a web browser.
What can Node.js be used for?
Node.js is primarily used for non-blocking, event-driven servers, due to its single-threaded nature. It’s used for traditional web sites and back-end API services, but was designed with real-time, push-based architectures in mind.
What is a REPL?
provides a Read-Eval-Print-Loop (REPL) implementation that is available both as a standalone program or includible in other applications.
When was Node.js created?
May 27, 2009
What back end languages have you heard of?
python, c, c++, java, ruby, php
What is a computer process?
a process is the instance of a computer program that is being executed by one or many threads. It contains the program code and its activity.
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, so having at least a cursory awareness of computer processes is necessary
What is the process object in a Node.js program?
The process object is a global 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, it is always available to Node.js applications without using require(). It can also be explicitly accessed using require(): const process = require('process');
What is the data type of process.argv in Node.js?
array
What is a JavaScript module?
In the Node.js module system, each file is treated as a separate module.
What values are passed into a Node.js module’s local scope?
__dirname, __filname, exports, module, require()
Give two examples of truly global variables in a Node.js program.
console, process
What is the purpose of module.exports in a Node.js module?
Module exports are the instruction that tells Node.js which bits of code (functions, objects, strings, etc.) to “export” from a given file so other files are allowed to access the exported code.
How do you import functionality into a Node.js module from another Node.js module?
require
What is the JavaScript Event Loop?
event loop pushes anything that is queued to the callstack if it is empty
What is different between “blocking” and “non-blocking” with respect to how code is executed?
blocking is code that is slow
What is a directory?
a folder that contains other directories and files
What is a relative file path?
The path with reference to current directory is called relative
What is an absolute file path?
An absolute import path is a path that starts from a root, and you need to define a root first
What module does Node.js include for manipulating the file system?
fs module
What method is available in the Node.js fs module for writing data to a file?
fs.writeFile( )
Are file operations using the fs module synchronous or asynchronous?
both