Node.js, React, Express, SQL, PostgreSQL Flashcards
What is Node.js?
an open-source, 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?
lets developers use JavaScript to write command line tools and server-side scripting
basically - lets you use javaScript everywhere - not just within the browser
What is a REPL?
Read-eval-print loop
also termed an interactive toplevel or language shell
a simple interactive computer programming environment that takes single user inputs, executes them, and returns the result to the user
executed piecewise
When was Node.js created?
May 27, 2009
What back end languages have you heard of?
java python ruby php C++ C#
What is a computer process?
A process that 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?
521
Why should a full stack web developer know that computer processes exist?
bc Full Stack Web development is based on making multiple processes work together to form one application
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?
global - always available to Node.js applications
What is the data type of process.argv in Node.js?
an array of strings
What is a JavaScript Module?
a single .js file
What values are passed into a Node.js module’s local scope?
module & exports objects
convenience variables: __filename and __dirname
require()
Give two examples of truly global variables in a Node.js program
process
global
What is the purpose of module.exports in a Node.js module?
they tell Node.js which bits of code to export from one file so they can be accessed in another
How do you import functionality into a Node.js module from another Node.js module?
export it from the module with module.exports or exports and use require() in the module you want to use it in.
What is a directory?
a collection of files
also known as a ‘folder’
What is a relative file path?
location that is relative to the current directory
What is an absolute file path?
full URL or file path from the root to a file
starts with ‘/’
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?
asynchronous
How do you add express to your package dependencies?
npm i express within directory containing json.package
What express application method starts the server and binds it to a network port?
listen()
How do you mount a middleware with an Express application?
the .use() method
Which objects does an Express application pass to your middleware to manage the request/response lifecycle of the server
request & response objects
What is the appropriate Content-type header for HTTP messages that contain JSON in their bodies?
application/json
What does the express.json() middleware do and when would you need it?
parses incoming requests with JSON payloads and is based on body-parser
used whenever the content-type header matches the type option
What is PostgreSQL and what are some alternative relational databases?
an open-source Relational Database Management System
MySQL, SQL Server by Microsoft, and Oracle by Oracle Corp
What are some advantages of learning a relational database?
they are the most widely used kind of database
support good guarantees about data integrity
most web developers work with a relational database at least a little bit during their career
What is one way to see if PostgreSQL is running?
sudo service postgresql status
sudo service postgresql start
sudo service postgresql stop
What is a database schema?
a collection of tables that defines how the data in a relational database should be organized
organization of data
What is a table?
where relational databases store data in relations
a table is a list of rows each having the same set of attributes
What is a row?
a single structured data item in a table
collection of values that correspond to the attributes of that table
What is SQL and how is it different from languages like JavaScript?
Structured Query Language
a domain specific language used in programming and designed for managing data held in a relational database management system or for stream processing in a relational data stream management system
useful in handling structured data
SQL is declarative not imperative
How do you retrieve specific columns from a database table?
select keyword followed by column in double quotes followed by from keyword and database in double quotes
How do you filter rows based on some specific criteria?
use the “where” keyword followed by where you want to grab data from, the operator and the data you want in single quotes
where needs to evaluate to true or false