Skip to content

Instantly share code, notes, and snippets.

@szemate
Last active July 22, 2022 11:03
Show Gist options
  • Select an option

  • Save szemate/43524c7888f9dd00a30b8d5525ed3d5c to your computer and use it in GitHub Desktop.

Select an option

Save szemate/43524c7888f9dd00a30b8d5525ed3d5c to your computer and use it in GitHub Desktop.

Revisions

  1. szemate revised this gist Jul 22, 2022. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions node-week1-exercises.md
    Original 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.
  2. szemate revised this gist Apr 17, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion node-week1-exercises.md
    Original 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.
    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;
  3. szemate revised this gist Apr 17, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion node-week1-exercises.md
    Original 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 directory in VSCode.
    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.
  4. szemate revised this gist Apr 17, 2021. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions node-week1-exercises.md
    Original 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",
    "largePicture": "/profiles/butters/image?size=large",
    "smallPicture": "/profiles/butters/image?size=small"
    "largeImage": "/profiles/butters/image?size=large",
    "smallImage": "/profiles/butters/image?size=small"
    }
    ```
  5. szemate revised this gist Apr 17, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion node-week1-exercises.md
    Original 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 that contains the student's profile endpoint, one with the large profile picture and one with the small profile picture. E.g.
    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",
  6. szemate revised this gist Apr 17, 2021. 1 changed file with 13 additions and 1 deletion.
    14 changes: 13 additions & 1 deletion node-week1-exercises.md
    Original 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.
    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"
    }
    ```
  7. szemate revised this gist Apr 17, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion node-week1-exercises.md
    Original 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 (optional)
    ## 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.
  8. szemate revised this gist Apr 17, 2021. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions node-week1-exercises.md
    Original 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 link to the student's profile endpoint, to the large profile picture
    and to the small profile picture.
    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.
  9. szemate revised this gist Apr 17, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion node-week1-exercises.md
    Original 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. E.g.
    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;
  10. szemate revised this gist Apr 17, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion node-week1-exercises.md
    Original 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.
    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.
  11. szemate created this gist Apr 17, 2021.
    37 changes: 37 additions & 0 deletions node-week1-exercises.md
    Original 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.