Cowrywise UUID
This API will return a key-value pair of randomly generated UUID. The Key is the timestamp when the API generates the UUID, and the value will be UUID. While the server is running, it should return all the previous UUIDs ever generated by the API alongside a new UUID whenever the API is called.
Installation
- Create the ".env" file and populate it based on the keys in the "sample.env"
To generate a secret key, you can visit djecrety.
cat sample.env > .env
- There are two ways to run the project locally. (Run all commands from the project root folder)
- Docker.
The command above will execute the build script to start a docker container for the project, expose it on port 8000 and run all migrations.
chmod a+x ./build.sh ./build.sh
- Virtual Environment
- Install requirements.
Poetry can be used to create a virtual environment and install all dependencies.Without poetry, the user will create and activate their virtual environment with whatever tool they prefer. Note: Install all dependencies for this project in a new virtual environmentpoetry install
pip install -r requirements.txt
- Run migrations
python manage.py migrate
- Install requirements.
- Docker.
Usage
If you installed the project without docker, you have to run it manually.
python manage.py runserver
You can then access the project via your browser or any API testing tool of your choice.
Example with curl:
curl -X GET http://localhost:8000/api/v1/uuid/?format=json
Testing
- You can run all tests with pytest. (Run all commands from the project root folder)
The command above will run all unit tests with pytest and type checking with mypy
pytest --mypy