With the rise of IoT there is a rise in need of reliable cloud storage. Most IoT projects only need to store key-value pairs. Key-value pair is exactly what it means - an entity with a searchable key and a corresponding value. E.g.:
{ "key": "temp_dev0", "value": "87" }
Create the following public APIs. (Note: All APIs should accept the request and return a response of "application/json" type. Store the key-value in the DATABASE (local or in-memory) for TWO extra points.):
- GET - "/keys/{key}" - Get key-value pair by key. Return 404 (Not Found) if the key does not exist.
- POST or PUT - "/keys" - Add a key-value pair. Accept JSON body with the above schema. Return 409 (Conflict code) if the key already exists.
- PATCH - "/keys/{key}/{value}" - Update the value of the key. Return 404 (Not Found) if the key does not exist.
- DELETE - "/keys/{key}" - Delete the key-value pair by key. Return 404 (Not Found) if the key does not exist.