Skip to content

Instantly share code, notes, and snippets.

@zetafish
Created April 8, 2016 09:55
Show Gist options
  • Save zetafish/9ae2e488b56990f9cff977e1c4b4ced4 to your computer and use it in GitHub Desktop.
Save zetafish/9ae2e488b56990f9cff977e1c4b4ced4 to your computer and use it in GitHub Desktop.

Assignment

You are going to write a simple webserver that remembers how many times an endpoint is called.

Step 1

Create a simple webserver that responds to '/' by returning hello world. I.e.

$ curl http://localhost:5000/

hello world

Step 2

Extend the webserver to respond to '/file1' by returning the contents of a json file file1. I.e

$ curl http://localhost:5000/file1

{
  "name": "file1",
  "count": 0
}

Step 3

Extend the webserver to remember the number of times '/file1' has been called. The return value of the '/file1' should reflect the number of times '/file1' has been called. So when calling '/file1' for the 30th time we should have:

$ curl http://localhost:5000/file1

{
  "name": "file1",
  "count": 30
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment