Bab: HTTP Request and Basic Routing with ExpressJS
Deadline: Selasa, 19 September 2017 pk 19.19
- Pahami perbedaan request GET dan POST
- Pahami Route paths
- Pahami Route parameters
req.params: http://expressjs.com/en/4x/api.html#req.params
-
Buat 5 routes yang berbeda, dengan spesifikasi:
- Route biasa
- Route biasa with spesific route
- Routing using req.params
- Routing using req.query
Contoh
- Baris pertama: Get request url nya
- Baris kedua: Hasil print di browsernya
- /route_biasa
Hello world!
- /ini_juga_route_biasa
Hello kalian!
- /route_kedua/ini_spesific_route
Ini juga Hello world!
- a. /route_ketiga/foo bar
Heelllooo! foo bar
- b. /route_ketiga/paijooke
Heellooo! paijooke
- /route_keempat/user?nama=Basisdata Laboratory
Welcome to route empat, Basisdata Laboratory