Last active
July 22, 2022 11:03
-
-
Save szemate/43524c7888f9dd00a30b8d5525ed3d5c to your computer and use it in GitHub Desktop.
Revisions
-
szemate revised this gist
Jul 22, 2022 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ # Node Week 1 Exercises ## Exercise 1 1. Extract the contents of the zip file into a new directory and open the folder in VSCode. -
szemate revised this gist
Apr 17, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -24,7 +24,7 @@ Modify the `GET /profiles/eric/image` endpoint to accept a `size` query string p ## Exercise 4 Modify the request handlers so that they take the username as a route parameter. E.g. - `GET /profiles/kyle` should return the data about Kyle Broflovski in JSON format; - `GET /profiles/kenny/image?size=small` should return Kenneth McCormick's small profile picture; -
szemate revised this gist
Apr 17, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ ## Exercise 1 1. Extract the contents of the zip file into a new directory and open the folder in VSCode. 2. Initialise a new Node app in the directory. The entry point should be the existing `server.js`. 3. Install Express. 4. Create an Express app in `server.js` that listens on port 3000. -
szemate revised this gist
Apr 17, 2021 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -42,7 +42,7 @@ Modify the request handlers so that they take the username as a request paramete "school": "South Park Elementary", "grade": 4, "profile": "/profiles/butters", "largeImage": "/profiles/butters/image?size=large", "smallImage": "/profiles/butters/image?size=small" } ``` -
szemate revised this gist
Apr 17, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -33,7 +33,7 @@ Modify the request handlers so that they take the username as a request paramete ## Exercise 5 1. Create a `GET /profiles` endpoint that returns the array of all profiles in JSON format. 2. Extend every student object with a property of the student's profile endpoint, one of the large profile picture and one of the small profile picture. E.g. ``` { "username": "butters", -
szemate revised this gist
Apr 17, 2021 . 1 changed file with 13 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -33,4 +33,16 @@ Modify the request handlers so that they take the username as a request paramete ## Exercise 5 1. Create a `GET /profiles` endpoint that returns the array of all profiles in JSON format. 2. Extend every student object with a property that contains the student's profile endpoint, one with the large profile picture and one with the small profile picture. E.g. ``` { "username": "butters", "name": "Leopold Stotch", "age": 10, "school": "South Park Elementary", "grade": 4, "profile": "/profiles/butters", "largePicture": "/profiles/butters/image?size=large", "smallPicture": "/profiles/butters/image?size=small" } ``` -
szemate revised this gist
Apr 17, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -30,7 +30,7 @@ Modify the request handlers so that they take the username as a request paramete - `GET /profiles/kenny/image?size=small` should return Kenneth McCormick's small profile picture; - if the username doesn't exist the server shold return `404 Not Found` status. ## Exercise 5 1. Create a `GET /profiles` endpoint that returns the array of all profiles in JSON format. 2. Extend every student object with a property that contains the student's profile endpoint, one with the large profile picture and one with the small profile picture. -
szemate revised this gist
Apr 17, 2021 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -33,5 +33,4 @@ Modify the request handlers so that they take the username as a request paramete ## Exercise 5 (optional) 1. Create a `GET /profiles` endpoint that returns the array of all profiles in JSON format. 2. Extend every student object with a property that contains the student's profile endpoint, one with the large profile picture and one with the small profile picture. -
szemate revised this gist
Apr 17, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -24,7 +24,7 @@ Modify the `GET /profiles/eric/image` endpoint to accept a `size` query string p ## Exercise 4 Modify the request handlers so that they take the username as a request parameter from the endpoint. E.g. - `GET /profiles/kyle` should return the data about Kyle Broflovski in JSON format; - `GET /profiles/kenny/image?size=small` should return Kenneth McCormick's small profile picture; -
szemate revised this gist
Apr 17, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ ## Exercise 1 1. Extract the contents of the zip file into a new directory and open the directory in VSCode. 2. Initialise a new Node app in the directory. The entry point should be the existing `server.js`. 3. Install Express. 4. Create an Express app in `server.js` that listens on port 3000. 5. Create a new request in Postman to make sure that the server is working. -
szemate created this gist
Apr 17, 2021 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,37 @@ ## Exercise 1 1. Extract the contents of the zip file into a new directory and open the directory in VSCode. 2. Initialise a new Node app in the directory. 3. Install Express. 4. Create an Express app in `server.js` that listens on port 3000. 5. Create a new request in Postman to make sure that the server is working. ## Exercise 2 1. Create a `GET /profiles/eric` endpoint that returns the data about Eric Cartman in JSON format. 2. Create a `GET /profiles/eric/image` endpoint that returns Eric's large profile picture. 3. Test the endpoints in a web browser. 4. Test the endpoints with Postman. ## Exercise 3 Modify the `GET /profiles/eric/image` endpoint to accept a `size` query string parameter so that - `GET /profiles/eric/image?size=large` should return Eric's large profile picture; - `GET /profiles/eric/image?size=small` should return Eric's small profile picture; - `GET /profiles/eric/image` (without the `size` parameter) should return Eric's large profile picture; - for any other value of the `size` parameter the server should return `400 Bad Request` status. ## Exercise 4 Modify the request handlers so that they take the username as a request parameter. E.g. - `GET /profiles/kyle` should return the data about Kyle Broflovski in JSON format; - `GET /profiles/kenny/image?size=small` should return Kenneth McCormick's small profile picture; - if the username doesn't exist the server shold return `404 Not Found` status. ## Exercise 5 (optional) 1. Create a `GET /profiles` endpoint that returns the array of all profiles in JSON format. 2. Extend every student object with a link to the student's profile endpoint, to the large profile picture and to the small profile picture.