- Extract the contents of the zip file into a new directory and open the folder in VSCode.
- Initialise a new Node app in the directory. The entry point should be the existing
server.js. - Install Express.
- Create an Express app in
server.jsthat listens on port 3000. - Create a new request in Postman to make sure that the server is working.
- Create a
GET /profiles/ericendpoint that returns the data about Eric Cartman in JSON format. - Create a
GET /profiles/eric/imageendpoint that returns Eric's large profile picture. - Test the endpoints in a web browser.
- Test the endpoints with Postman.
Modify the GET /profiles/eric/image endpoint to accept a size query string parameter so that
GET /profiles/eric/image?size=largeshould return Eric's large profile picture;GET /profiles/eric/image?size=smallshould return Eric's small profile picture;GET /profiles/eric/image(without thesizeparameter) should return Eric's large profile picture;- for any other value of the
sizeparameter the server should return400 Bad Requeststatus.
Modify the request handlers so that they take the username as a route parameter. E.g.
GET /profiles/kyleshould return the data about Kyle Broflovski in JSON format;GET /profiles/kenny/image?size=smallshould return Kenneth McCormick's small profile picture;- if the username doesn't exist the server shold return
404 Not Foundstatus.
- Create a
GET /profilesendpoint that returns the array of all profiles in JSON format. - 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",
"name": "Leopold Stotch",
"age": 10,
"school": "South Park Elementary",
"grade": 4,
"profile": "/profiles/butters",
"largeImage": "/profiles/butters/image?size=large",
"smallImage": "/profiles/butters/image?size=small"
}