https://github.com/stelligent/stellitime-api
Example mini-app to use during interview process.
https://github.com/stelligent/stellitime-api
Last synced: 3 months ago
JSON representation
Example mini-app to use during interview process.
- Host: GitHub
- URL: https://github.com/stelligent/stellitime-api
- Owner: stelligent
- License: mit
- Created: 2019-08-15T18:24:54.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-01-07T21:33:42.000Z (over 6 years ago)
- Last Synced: 2025-03-24T05:26:11.420Z (about 1 year ago)
- Language: Python
- Size: 551 KB
- Stars: 3
- Watchers: 16
- Forks: 13
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# stellitime-api
## Small sample program to facilitate discussions
### Description
./app.py invokes a get() or post() operation, depending on absense or presence of a payload argument consisting of a JSON payload containing a "message" string property.
The counter value is stored in a DynamoDB table that has a single row with `id` and `counter_value` attributes. The key field `id` can be overridden by `export COUNTER_KEY=some-key`.
* the `get()` function returns a JSON payload:
* current time
* current counter_value from the DynamoDB table
* and the message `Automation For The People`
* the `put()` function takes a JSON payload containing a `message` property as input, and also returns a JSON payload:
* current time
* incremented counter_value from the DynamoDB table
* and a copy of message that was passed on the command line.
## Setup:
Type `make all` to:
* install python3 prerequisites stored in `requirements.txt`
* deploy a tiny Cloudformation stack creating the DynamoDB table.
## Example Usage:
* The retrieve the current time and the current counter value (the `get()` function):
```
./app.py
```
* To echo an arbitary message, and increment the counter (the `put()` function):
```
./app.py '{ "message" : "some-string" }'
```
### Example Output
(colorization courtesy of `jq`)