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

  1. Create the ".env" file and populate it based on the keys in the "sample.env"
    cat sample.env > .env
    To generate a secret key, you can visit djecrety.
  2. There are two ways to run the project locally. (Run all commands from the project root folder)
    1. Docker.
      chmod a+x ./build.sh
      ./build.sh
      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.
    2. Virtual Environment
      1. Install requirements.
        Poetry can be used to create a virtual environment and install all dependencies.
        poetry install
        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 environment
        pip install -r requirements.txt
      2. Run migrations
        python manage.py migrate

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

  1. You can run all tests with pytest. (Run all commands from the project root folder)
    pytest --mypy
    The command above will run all unit tests with pytest and type checking with mypy