Skip to content

Commit d9c634f

Browse files
authored
Update LESSONPLAN.md
1 parent 68ccb9f commit d9c634f

File tree

1 file changed

+38
-37
lines changed

1 file changed

+38
-37
lines changed

Week1/LESSONPLAN.md

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -12,30 +12,26 @@ The purpose of this class is to introduce to the student:
1212

1313
FIRST HALF (12.00 - 13.30)
1414

15-
1. What are APIs and how to interact with them
16-
17-
Notes:
15+
## 1. What are APIs and how to interact with them
1816

17+
### Explanation
1918
- APIs are created by providers and used by consumers (BE provider, FE consumer)
20-
- Give real life example like (Devices like TV, any machine + electricity power socket interface which provides power to any external device)
21-
- Communication between software and user needs UI interface but software and software needs API as an interface.
2219
- Part of an application that can be communicated with from an outside source
2320
- Connect to it using "endpoints"
24-
- Mostly used to request data from some service
2521
- Software well-known APIs (Fb APIs, Twitter APIs, Maps APIs, weather APIs);
2622
- API doesn't care which language or technology is used in the consumer or the provider
2723

28-
### Types of APIs:-
24+
#### Types of APIs:
2925
- Private: for employees only under a company network for internal use.
3026
- Semi-private: for clients who paid for the API.
3127
- Public: for everyone on the web.
3228

33-
### Architecture styles of API:
29+
#### Architecture styles of API:
3430
- Single purpose: API that gives a direct and specific service.
3531
- Aggregated API: one API as a wrapper for multiple APIs.
3632
- Web services API: punch of APIs working together to forma whole app.
3733

38-
### Basic structure of REST API
34+
#### Basic structure of REST API
3935

4036
- Endpoint: https://api.example.com
4137
- Endpoint with version: https://api.example.com/v1
@@ -46,41 +42,32 @@ Notes:
4642
* https://api.example.com/v1/users/1/edit
4743
- Query params:
4844
* https://api.example.com/v1/users?limit=10
45+
### Example
46+
- Give real life example like (Devices like TV, any machine + electricity power socket interface which provides power to any external device)
4947

50-
51-
**Show examples**
5248
Use [open weather app](https://openweathermap.org/api)
5349
- Create an account or use the public key used in the examples.
5450
- Use the endpoint for forecast and make a request via js file [Get current city weather by city name](https://openweathermap.org/current#name)
5551
- Let them do the same using another endpoint [Get hourly forcasting by city name](https://openweathermap.org/api/hourly-forecast#name5)
52+
### Excercise
5653

54+
### Essence
55+
- Mostly used to request data from some service
56+
- Communication between software and user needs UI interface but software and software needs API as an interface.
5757

58-
2. What is `AJAX` and how to apply it (`XMLHttpRequest`)
59-
60-
Notes:
58+
## 2. What is `AJAX` and how to apply it (`XMLHttpRequest`)
6159

60+
### Explanation
6261
- Before AJAX all page reload for all requests, via refreshing the url in the address bar with the new resource.
6362
- It's a technique, not a technology
6463
- `AJAX` stands for Asynchronous JavaScript and XML
6564
- Nowadays we use `JSON` instead of `XML`
6665
- Fetch data without reloading the page
6766
- The XMLHttpRequest API is defined in the browser (window.XMLHttpRequest)
68-
69-
**Do exercise**
70-
71-
72-
Steps of doing the following example:-
73-
** Install the live server plugin in VS (go to plugins -> live server -> install)
74-
1. Create self-invoked function to wrap your code
75-
2. Create an object instance of `XMLHttpRequest`
76-
3. Call the `open` function to fill it with the Request URL and the request Method
77-
4. Call the `send` function to make the request
78-
5. Add event listener with a callback for the sucess event `load`
79-
80-
67+
### Example
8168
Example using the XMLHttpRequest
8269

83-
```
70+
```javascript
8471
const oReq = new XMLHttpRequest();
8572
oReq.open('GET', `https://api.openweathermap.org/data/2.5/weather?q=${cityName}`);
8673
oReq.send();
@@ -110,23 +97,30 @@ oReq.load = function (event) {
11097

11198
```
11299

100+
### Excercise
113101

114-
SECOND HALF (14.00 - 16.00)
102+
Steps of doing the following example:-
103+
** Install the live server plugin in VS (go to plugins -> live server -> install)
104+
1. Create self-invoked function to wrap your code
105+
2. Create an object instance of `XMLHttpRequest`
106+
3. Call the `open` function to fill it with the Request URL and the request Method
107+
4. Call the `send` function to make the request
108+
5. Add event listener with a callback for the sucess event `load`
115109

116-
3. How to use libraries (`axios`)
110+
### Essence
117111

118-
Notes:
112+
SECOND HALF (14.00 - 16.00)
113+
114+
## 3. How to use libraries (`axios`)
119115

116+
### Explanation
120117
- A library is a code solution a developer (or a team) has written to a common problem
121118
- Usually open-source
122119
- Helps to solve a problem within an application
123120
- Read the documentation on how to use it
124-
125-
**Do Exercise**
126-
121+
### Example
127122
Same example but using axios
128-
129-
```
123+
```javascript
130124
axios
131125
.get(`https://api.openweathermap.org/data/2.5/weather?q=${cityName}`)
132126
.then(function (response) {
@@ -141,4 +135,11 @@ axios
141135
});
142136
```
143137

144-
> Note: Give example at the end with binding/showing these data in a DOM element like a <div> or a list instead of only showing them on the console using console.log.
138+
> Note: Give example at the end with binding/showing these data in a DOM element like a <div> or a list instead of only showing them on the console using console.log.
139+
140+
### Excercise
141+
### Essence
142+
143+
144+
145+

0 commit comments

Comments
 (0)