Promises, GET parameters and Article refactoring

2 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$49.99
List Price:  $69.99
You save:  $20
€44.05
List Price:  €61.68
You save:  €17.62
£37.58
List Price:  £52.62
You save:  £15.03
CA$69.44
List Price:  CA$97.22
You save:  CA$27.78
A$78.41
List Price:  A$109.78
You save:  A$31.37
S$65.75
List Price:  S$92.05
You save:  S$26.30
HK$387.76
List Price:  HK$542.90
You save:  HK$155.13
CHF 41.54
List Price:  CHF 58.16
You save:  CHF 16.61
NOK kr522.97
List Price:  NOK kr732.21
You save:  NOK kr209.23
DKK kr328.90
List Price:  DKK kr460.49
You save:  DKK kr131.58
NZ$83.99
List Price:  NZ$117.60
You save:  NZ$33.60
د.إ183.61
List Price:  د.إ257.07
You save:  د.إ73.46
৳6,091.40
List Price:  ৳8,528.46
You save:  ৳2,437.05
₹4,271.75
List Price:  ₹5,980.80
You save:  ₹1,709.04
RM218.65
List Price:  RM306.13
You save:  RM87.48
₦80,730.85
List Price:  ₦113,029.65
You save:  ₦32,298.80
₨14,091.30
List Price:  ₨19,728.96
You save:  ₨5,637.65
฿1,677.91
List Price:  ฿2,349.21
You save:  ฿671.30
₺1,920.75
List Price:  ₺2,689.20
You save:  ₺768.45
B$284.04
List Price:  B$397.68
You save:  B$113.64
R945.21
List Price:  R1,323.38
You save:  R378.16
Лв86.13
List Price:  Лв120.59
You save:  Лв34.45
₩71,921.98
List Price:  ₩100,696.53
You save:  ₩28,774.54
₪180.85
List Price:  ₪253.20
You save:  ₪72.35
₱2,814.26
List Price:  ₱3,940.19
You save:  ₱1,125.93
¥7,179.56
List Price:  ¥10,051.96
You save:  ¥2,872.40
MX$983.64
List Price:  MX$1,377.18
You save:  MX$393.53
QR182.75
List Price:  QR255.87
You save:  QR73.11
P686.29
List Price:  P960.87
You save:  P274.57
KSh6,463.70
List Price:  KSh9,049.70
You save:  KSh2,586
E£2,547.49
List Price:  E£3,566.69
You save:  E£1,019.20
ብር6,681.17
List Price:  ብር9,354.18
You save:  ብር2,673
Kz45,590.88
List Price:  Kz63,830.88
You save:  Kz18,240
CLP$46,812.37
List Price:  CLP$65,541.06
You save:  CLP$18,728.69
CN¥364.27
List Price:  CN¥510.01
You save:  CN¥145.74
RD$2,975.10
List Price:  RD$4,165.38
You save:  RD$1,190.28
DA6,619.03
List Price:  DA9,267.17
You save:  DA2,648.14
FJ$112.99
List Price:  FJ$158.20
You save:  FJ$45.20
Q386.10
List Price:  Q540.58
You save:  Q154.47
GY$10,489.05
List Price:  GY$14,685.51
You save:  GY$4,196.46
ISK kr6,375.22
List Price:  ISK kr8,925.82
You save:  ISK kr2,550.60
DH464.99
List Price:  DH651.02
You save:  DH186.03
L862.86
List Price:  L1,208.08
You save:  L345.21
ден2,708.74
List Price:  ден3,792.46
You save:  ден1,083.71
MOP$400.53
List Price:  MOP$560.77
You save:  MOP$160.24
N$935.59
List Price:  N$1,309.90
You save:  N$374.31
C$1,838.46
List Price:  C$2,573.99
You save:  C$735.53
रु6,841.02
List Price:  रु9,577.98
You save:  रु2,736.95
S/185.02
List Price:  S/259.04
You save:  S/74.02
K207.50
List Price:  K290.52
You save:  K83.01
SAR187.51
List Price:  SAR262.53
You save:  SAR75.02
ZK1,410.01
List Price:  ZK1,974.13
You save:  ZK564.11
L219.29
List Price:  L307.02
You save:  L87.73
Kč1,100.07
List Price:  Kč1,540.19
You save:  Kč440.12
Ft17,940.87
List Price:  Ft25,118.65
You save:  Ft7,177.78
SEK kr485.01
List Price:  SEK kr679.06
You save:  SEK kr194.04
ARS$58,712.48
List Price:  ARS$82,202.17
You save:  ARS$23,489.69
Bs346.41
List Price:  Bs485.01
You save:  Bs138.59
COP$215,920.08
List Price:  COP$302,305.39
You save:  COP$86,385.31
₡25,270.56
List Price:  ₡35,380.81
You save:  ₡10,110.24
L1,299.69
List Price:  L1,819.68
You save:  L519.98
₲401,259.06
List Price:  ₲561,794.79
You save:  ₲160,535.73
$U2,086.69
List Price:  $U2,921.54
You save:  $U834.84
zł188.24
List Price:  zł263.56
You save:  zł75.31
Already have an account? Log In

Transcript

Think new features to our projects, I would like to introduce a very basic concept that we need in order to go. This is the concept of promise that is defined as an object representing the event or completion or failure of an a synchronous operation. We are not going to cover promises here in this course. But before going on, please be sure to refresh your memory on promises following the Mozilla guide using promises. We are working with a study list of articles but of course the articles should be in a database. So we are using promises anyway, visited this assumption.

Until now, we had this list of articles to perform some operations but to perform more advanced tasks, we create an article class whose constructive problem Refer the current articles definition and that is some useful method. According to this new object, we are going to change the articles list in order to use our objects that will reflect the previous articles list. If you want to perform some basic operations over this list right now, we have to use a related operations and basic checks over the single article keys. But what if Li there our list of articles will be moved to a database, we will have to find every place in which the list was parse it and modify the code according to the new database. So we will introduce a class that will hide the separations. So we will just call methods without caring about the delay mode to store articles before doing that, Have to see how to retrieve get parameters from HTTP requests.

Express defines route params. Route parameters are named URLs segments that are used to capture the values specified or their position in the URL. In our case, we will need to retrieve the article id to show a specific article details. So we will use the app dot get slash articles slash article id. And we will retrieve this using the req dot params dot article id

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.