NODE 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?
It is commonly used to build back ends for Web applications, command-line programs, or any kind of automation that developers wish to perform.
What is a REPL?
read–eval–print loop / interactive computer programming environment that takes single user inputs, executes them, and returns the result to the user; a program written in a REPL environment is executed piecewise
When was Node.js created?
May 27, 2009 by Ryan Dahl
What back end languages have you heard of?
Java , Ruby , Python, C++, PHP
What is a computer process?
is the instance of a computer program that is being executed by one or many threads.
Roughly how many computer processes are running on your host operating system (Task Manager or Activity Monitor)?
alot
Why should a full stack Web developer know that computer processes exist?
You need to know how to make multiple process work together in order to form one application
What is the process object in a Node.js program?
its 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, it is always available to Node.js applications without using require(). It can also be explicitly accessed using require()
What is the data type of process.argv in Node.js?
an array
What is a JavaScript module?
a single .js file / js file containing code
What values are passed into a Node.js module’s local scope?
exports, require, module, __dirname, __filename
Give two examples of truly global variables in a Node.js program.
Process , console , setInterval, setTimeOut
variables available in every file
What is the purpose of module.exports in a Node.js module?
to be able to separate functions into their own files and make it easier for you to find what you are looking for
How do you import functionality into a Node.js module from another Node.js module?
by using module.exports on what you want to export and require where you need it
What is the JavaScript Event Loop?
it allows JS to offload its work onto the browser and gives the illusion of multithread / the order in which js is run
“The event loop job is to look at the stack and look at the task queue. If the stack is empty, it takes the first thing on the queue and pushed it on to the stack.”
What is different between “blocking” and “non-blocking” with respect to how code is executed?
Blocking stops JS from continuing to run the rest of the code and slows things down
Non blocking does not stop JS from continuing to run
What is a directory?
folders
What is a relative file path?
relative to a current directory / relative to where your starting from
What is an absolute file path?
where the root of the drive all the way to the path to the file/ the entire path
What module does Node.js include for manipulating the file system?
fs / filesystem 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?
asynchronous
What is a client?
service requester
What is a server?
providers of a resource or service / A server host runs one or more server programs, which share their resources with clients. / a server is more likely software on a computer
Which HTTP method does a browser issue to a web server when you visit a URL?
GET method
What are HTTP headers?
HTTP headers let the client and the server pass additional information with an HTTP request or response.
/ Key value pairs
What is on the first line of an HTTP response message?
Protocol version
Status Code
Status Text
What is on the first line of an HTTP request message?
header /
http method
Path
Version number
Is a body required for a valid HTTP message?
NO
What is NPM?
Worlds largest software registry. Used by developers to borrow and share packages. / Node Package Manager