What is a CLI?
Command line interface, an interface between users and a command line interpreter/processor. It takes in lines of text as commands
What is a GUI?
Graphical user interface, allows a user to interact with a computer through graphical icons (as opposed to text lines like with a CLI)
Give at least one use case for each of the commands listed in this exercise.
- `man` - `cat` - `ls` - `pwd` - `echo` - `touch` - `mkdir` - `mv` - `rm` - `cp`
mancatlspwdechoconsole.log of the command line, prints somethingtouchmkdirmvrmcpWhat is Node.js?
A JavaScript runtime that is asynchronous and event driven
A runtime is “where the code gets run” and has all the stuff that handles interacting with memory, garbage collecting, interfacing with the OS, how parameters get passed, etc.
What can Node.js be used for?
They claim it is “to build scalable network applications”
JavaScript can be used to write command line tools and server-side scripting
It allows for JavaScript to be the language for both server and client side
What is a REPL?
read-eval-print-loop
Evaluates code one line at a time rather than running an entire file
Takes in user input one line at a time (read), evaluates the code (eval), and outputs the result (print), and it repeats (loop)
~Interactive shell environment
When was Node.js created?
Initial release was May 27, 2009
What back end languages have you heard of?
Scripting/interpreted: Python, JavaScript, Ruby, PHP, Perl, SQL (can’t really write a backend with this)
Compiled: C, C++, Go, Haskell, Crystal, Rust
Partially compiled: Java (JVM), Scala (JVM), clojure (JVM), kotlin (JVM), C# (.NET CLR), F# (.NET CLR), Visual Basic
What is a JavaScript module?
It is a single .js file meant to separate out some functionality (modularized code, modular programming)
What values are passed into a Node.js module’s local scope?
module, exports, \_\_dirname , \_\_filename, require
Give two examples of_truly_global variables in a Node.js program.
globalprocessconsoleclearImmediate(), clearInterval(), clearTimeout(), setImmediate/Interval/TimeoutWhat is the purpose ofmodule.exportsin a Node.js module?
Allow things (any data types) to be returned from a module called by require()
How do you import functionality into a Node.js module from another Node.js module?
The source module should have the desired functionality in its `module.exports` The calling module should then `require()` the source file - The return of that `require` call will be `module.exports` from the source, to then be handled however desired (likely assigned to a variable)
What is a directory?
A store of “directions” to files or other directories
A file that lists locations to other files
What is a relative file path?
A path to a file that starts/assumes a starting position of the current directory
Set of directions from current directory to there
What is an absolute file path?
A path to a file that has the entire path explicitly noted
From the root of the file system
What module does Node.js include for manipulating the file system?
The fs.js module
What method is available in the Node.jsfsmodule for writing data to a file?
fs.writeFile() although there is also fs.write() which does something similar with file descriptors
Are file operations using thefsmodule synchronous or asynchronous?
They are asynchronous (unless we use something like readFileSync(), so sometimes synchronous)
What is a client?
A requester of services from a server
What is a server?
A provider of services to one or many clients (does the processing)
Which HTTP method does a browser issue to a web server when you visit a URL?
GET
What is on the first line of an HTTPrequestmessage?
GET, POST, PUT), known as an HTTP methodWhat is on the first line of an HTTPresponsemessage?