HTTP, NPM, NODE, Express Flashcards

1
Q

What is a client?

A

A service requestor.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a server?

A

A service provider.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which HTTP method does a browser issue to a web server when you visit a URL?

A

a get request

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What three things are on the start-line of an HTTP request message?

A

The method, verbs i.e. GET PUT, POST or a noun HEAD, OPTIONS, the target (URL), HTTP version

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What three things are on the start-line of an HTTP response message?

A

Version ie. (HTTP/1.1),
status code (404),
status text i.e. 404 Not found (for human reading)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are HTTP headers?

A

A string followed by colons and a value.
A key value pair.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Where would you go if you wanted to learn more about a specific HTTP Header?

A

MDN

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Is a body required for a valid HTTP request or response message?

A

No. Their could just be a confirmation in the start line.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is AJAX?

A

Asynchronus processing request, to load data with having a user reload a page.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does the AJAX acronym stand for?

A

Asynchronous JavaScript And XML

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which object is built into the browser for making HTTP requests in JavaScript?

A

XMLHttpRequest object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What event is fired by XMLHttpRequest objects when they are finished loading the data from the server?

A

load event.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Bonus Question: An XMLHttpRequest object has an addEventListener() method just like DOM elements. How is it possible that they both share this functionality?

A

Prototype inheritance from the window.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is NPM?

A

Node-package manager.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a package?

A

A directory with one or more files, of a chunk of reusable code.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How can you create a package.json with npm?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is a dependency and how do you add one to a package?

A

A package that your package requires you to use. Version control, majorversion(breaking changes).minorversion(adds functionality backwards compat).bugfixversion(fixes something, should always update this)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What happens when you add a dependency to a package with npm?

A

It gets put into your package.json, and downloads the package and all dependencies in your node-modules.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What are some other popular package managers?

A

Yarn and PNPM.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

DEV dependencies.

A

Packages for when your in development, so they can easily removed at launch.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Scripts in npm?

A

Scripts allow you to create shortcut keywords to run different packages.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What is Express useful for?

A

Handling server requests.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

How does Express fit into a full-stack web application?

A

It helps handle your server requests, to get data from databases and send it to the client.

24
Q

How do you add express to your package dependencies?

A

npm i express

25
What Express application method starts the server and binds it to a network PORT?
.listen , we use port 8080 / With httppie you can just do < http :8080 > It assumes GET and localhost
26
What is Express middleware?
Function calls that respond to requests made to express.
27
What is Express middleware useful for?
Modify your data, return an html page, send a file to be downloaded? Lots of things?
28
How do you mount a middleware with an Express application?
You pass a directory as an argument and when the routing goes through this code is executed with the use method.
29
Which objects does an Express application pass to your middleware to manage the request/response lifecycle of the server?
The request and response objects.
30
Whats an api endpoint?
A specific URL.
31
What is the appropriate Content-Type header for HTTP messages that contain JSON in their bodies?
application/json.
32
What is the significance of an HTTP request's method?
A generalization of what a server should do.
33
What does the express.json() middleware do and when would you need it?
Parses incoming JSON.
34
What is SQL and how is it different from languages like JavaScript?
It' s declarative, it does what you ask.
35
How do you retrieve specific columns from a database table?
select followed by the column and then a from what table
36
How do you filter rows based on some specific criteria?
use the where keyword followed by column and your comparator statement.
37
What are the benefits of formatting your SQL?
READABILITY!
38
What are four comparison operators that can be used in a where clause?
=, !=, <, >
39
How do you limit the number of rows returned in a result set?
the limit keyword followed by a number, must be last statement.
40
How do you retrieve all columns from a database table?
select * from "tablename"
41
How do you control the sort order of a result set?
order by keyword ,defaults ascending, specify after the column name.
42
How do you add a row to a SQL table?
insert into "tablename" ("columnname", "columnname")
43
What is a tuple?
A list of values inside parentheses.
44
How do you add multiple rows to a SQL table at once?
add commas between tuples.
45
How do you get back the row being inserted into a table without a separate select statement?
returning * will return all sent. Is good to see autogenerated IDs
46
How do you update rows in a database table?
update , set = , usually followed by a filter statement where =
47
Why is it important to include a where clause in your update statements?
The where clause specifies which rows you should update.
48
How do you delete rows from a database table?
DELETE FROM WHERE = returning *;
49
How do you accidentally delete all rows from a table?
Forgetting a where statement.
50
What is a foreign key?
A reference to the primary key of another table.
51
How do you join two SQL tables?
JOIN using ()
52
How do you temporarily rename columns or tables in a SQL statement?
53
What is the purpose of the Express Static middleware?
to serve basic files to the client.
54
What does express.static() return?
Returns a response object or calls next.
55
What are several examples of static files?
CSS, Images, Index.html(when using react), basic javascript. Any files that don't change and aren't dynamic like react?
56
What is a good way to serve application images using Express?
Using relative links to a static image folder. Serving them statically.