node.js Flashcards
What is Node.js?
An asynchronous way for us to run javascript on something other than the browser
What can Node.js be used for?
It allows us to use JavaScript as the back end language of our applications
What is a REPL?
read–eval–print loop (REPL)
Takes in the input of a user, evaluated it, and prints it to the CLI
Similar to the console in a browser
If you want to execute a JaveScript file, how do you do that?
Run the following command:
node file.js
When was Node.js created?
2009
What back-end languages have you heard of?
PHP Python Rubyman Pearl JaveScript
What is a computer process?
An instance of a computer program being executed in one or more threads.
Roughly how many computer processes are running on your host operating system (Task Manager or Activity Monitor)?
About 176, including windows and background apps
Why should a full-stack Web developer know that computer processes exist?
We need to know which processes will be user side and server-side
What is the process object in a Node.js program?
A global object of the process itself
Much like the window is an implicit object in your HTML, a process is an implicit object in your JS file
How do you access the process object in a Node.js program?
You console.log(process) in your code, and just run the code with node.js
Exp: node process.js
What is the data type of process.argv in Node.js?
It is an array for strings
The first is the pathway to your node program, followed by the pathway of the JS file being run, followed by the arguments the user inserted when running the script with node
node echo.js ‘why do I need node to echo something?’
[
‘/usr/bin/node’,
‘/mnt/c/Users/user/repos/c0521-code-solutions/node-process-argv/echo.js’,
‘why do I need node to echo something?’
]
What is a JavaScript module?
An individual .js file being used in node
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