In this lecture we'll learn how to leverage the flask framework to create a web service that serves some RESTful API routes.
Build a web service that implements the following API routes.
- GET /api/hello/:name - returns a string: "Hello World <:name>"
- GET /api/data - return a dictionary as JSON that has the following contents
{ "temp": [20, 21, 21], "time": [10, 20, 30], "unit": "s" } - POST /api/add which takes the following JSON data:
Return the sum and status code 200 for a successful calculation. If not successful (b/c of validation) return the proper error status code.
{ "a": <some number>, "b": <some number> }