-
Notifications
You must be signed in to change notification settings - Fork 0
/
module_11_notes.txt
68 lines (56 loc) · 2.84 KB
/
module_11_notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
This is my first VS connector file
To integrate Google Drive with VS Code, go here: https://marketplace.visualstudio.com/items?itemName=GustavoASC.google-drive-vscode
{
There are two important takeaways from this code:
The first is that the get() method requires two arguments. The first is a string that describes the route the client will have to fetch from. The second is a callback function that will execute every time that route is accessed with a GET request.
The second takeaway is that we are using the send() method from the res parameter (short for response) to send the string Hello! to our client.
}
{
The (res, req) provide many methods, found here:
https://expressjs.com/en/api.html#res
https://expressjs.com/en/api.html#req
}
{
Difference between Development and Production:
Dev environment, local environment on your machine. Nothing developed affects production.
Separate keys and config files. All code tested.
Release: Users get updates first,
Development:
Staging: Add a layer of QA, helps test changes, replica of production environment.
Production: Tested, Production Database (Cloud hosted). ENV vairables separate to Dev variables.
- Cloud hosted
- Separate to
Enterprise: AWS, Azure
}
{
App Routes.
{
A param route must come after the other GET route.
}
}
{
Difference and appropriate use case for req.param vs. raq.qurey:
req.query is multifaceted, often combining multiple parameters, whereas req.param is specific to a single property, often intended to retrieve a single record.
}
{
Security about POST:
{
Accepting data from a client can be risky.
While we expect to receive the type of data we asked for,
there is nothing stopping a user from sending incorrect or malicious data to our server.
For this reason, there are validation libraries that ensure (on the server side) that the data meets certain criteria.
}
Check our Express validator
}
Legacy LORE
{
We use the name public to hold our front-end code because
that was the standard naming convention for it when servers
were primarily made with Apache web server software.
You can really call it whatever you want, but
typically the terms public or client are the names
developers use.
}
The FetchAPI:
- The Fetch API provides a JavaScript interface for accessing and manipulating parts of the HTTP pipeline, such as requests and responses. It also provides a global fetch() method that provides an easy, logical way to fetch resources asynchronously across the network.
This kind of functionality was previously achieved using XMLHttpRequest. Fetch provides a better alternative that can be easily used by other technologies such as Service Workers. Fetch also provides a single logical place to define other HTTP-related concepts such as CORS and extensions to HTTP.