File tree Expand file tree Collapse file tree
03-request-response/lecture Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11// import z from 'zod'
22// import { fakeFetch } from './utils'
33
4- const API = 'http://localhost:3333'
5- // const API = 'http://swapi.dev/api'
4+ // const API = 'http://localhost:3333'
5+ const API = 'http://swapi.dev/api'
66
77/****************************************
88 Part 1: Request
Original file line number Diff line number Diff line change 11// import { User, createAccount, addAccountUser } from './users'
22
3- const API = 'http://localhost:3333'
4- // const API = 'http://swapi.dev/api'
3+ // const API = 'http://localhost:3333'
4+ const API = 'http://swapi.dev/api'
55
66/****************************************
77 Part 1
Original file line number Diff line number Diff line change 1- const API = 'http://localhost:3333'
2- // const API = 'http://swapi.dev/api'
1+ // const API = 'http://localhost:3333'
2+ const API = 'http://swapi.dev/api'
33
44// Each practice below implements a main() function
55main ( )
Original file line number Diff line number Diff line change 1- const API = 'http://localhost:3333'
2- // const API = 'http://swapi.dev/api'
1+ // const API = 'http://localhost:3333'
2+ const API = 'http://swapi.dev/api'
33
44// Each practice below implements a main() function
55main ( )
88 Practice: 1
99*****************************************/
1010
11- // function wait(ms: number) {
12- // return new Promise((resolve) => {
13- // setTimeout(resolve, ms)
14- // })
15- // }
11+ function wait ( ms : number ) {
12+ return new Promise ( ( resolve ) => {
13+ setTimeout ( resolve , ms )
14+ } )
15+ }
1616
17- // // Re-write main to use async/await
17+ // Re-write main to use async/await
1818
19- // function main() {
20- // wait(1000).then(() => {
21- // console.log('Wait for one second')
22- // })
23- // }
19+ function main ( ) {
20+ wait ( 1000 ) . then ( ( ) => {
21+ console . log ( 'Wait for one second' )
22+ } )
23+ }
2424
2525/****************************************
2626 Practice: 2
Original file line number Diff line number Diff line change 33 "strict" : true ,
44 "module" : " commonjs" ,
55 // "module": "esnext",
6+ "moduleDetection" : " force" ,
67 "esModuleInterop" : true ,
78 "jsx" : " react" ,
89 "target" : " ES2020" ,
You can’t perform that action at this time.
0 commit comments