Last active
August 14, 2021 21:11
-
-
Save sandrabosk/51711d269ff44a8c4e2223fccd4abf3d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// How would you get the value of queries and params in the following examples? | |
// PARAMS: | |
// 1: | |
// https://dummyexample.com/albums/123cool4lbum | |
app.get('/albums/:albumId', (req, res) => { | |
console.log( /* your code goes here */) | |
}) | |
// 2: | |
// https://dummyexample.com/students/sandra | |
app.get('/students/:name', (req, res) => { | |
console.log( /* your code goes here */) | |
}) | |
// 3: | |
// https://dummyexample.com/nature/large/1 | |
app.get('/:imageType/:imageSize/:id', (req, res) => { | |
console.log( /* your code goes here */) | |
}) | |
// 4: | |
// https://dummyexample.com/stefan/123 | |
app.get('/:user/:albumId', (req, res) => { | |
console.log( /* your code goes here */) | |
}) | |
// QUERIES: | |
// 5: | |
// URL: https://localhost:3000/?category=coffee | |
app.get('/', (req, res) => { | |
console.log( /* your code goes here */) | |
}) | |
// 6: | |
// URL: https://localhost:3000/marketplace?category=code-review&type=apps | |
app.get('/marketplace', (req, res) => { | |
console.log( /* your code goes here */) | |
}) | |
// 7: | |
// URL: https://localhost:3000/search?city=barcelona&accommodation=hotel&transport=public | |
app.get('/search', (req, res) => { | |
console.log( /* your code goes here */) | |
}) | |
// 8: mix | |
// URL: https://localhost:3000/products/toys?prodID=123 | |
app.get('/products/:category', (req, res) => { | |
console.log( /* your code goes here */) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment