/uuid-api

API that generates UUID

Primary LanguagePythonMIT LicenseMIT

UUID API

example workflow
Generate and return all UUIDs generated

Database Specifications

  • UUID file fields:
    • ID – (mandatory, integer, unique)
    • UUID – (mandatory, string, cannot be larger than 128 characters)
    • timestamp – (mandatory, Datetime, cannot be in the past)

API specifications

  • UUID API:
    • The route UUID will return the specific all UUIDs including a new one generated when the api was called

Project setup

Before going through the steps make sure you have the following pre-installed

Tools and Resources

  1. Python 3.6+
  2. Virtualenv
  3. Postgresql
    1. Download the application link.
    2. Install Postgresql and set up root (postgres). link
    3. Set up two databases namely uuid_db and uuid_test_db.

Make sure to download/clone this repository and navigate to the folder in your terminal. Now follow the instructions below

  1. Create the virtual environment.
    virtualenv /path/to/venv --python=/path/to/python3

You can find out the path to your python3 interpreter with the command which python3.

  1. Set up .env file by duplicating the .example.env file(and editing if required).

  2. Activate the environment and install dependencies.

    • Linux

        source /path/to/venv/bin/activate
        pip install -r requirements\dev.linux.txt
    
    • Windows

        ./path/to/venv/bin/activate
        pip install -r requirements\dev.windows.txt
    
  3. Launch the service

    uvicorn main:app --workers 1 --host 0.0.0.0 --port 8008

Posting requests locally

When the service is running, try this link in your browser/Postman. send a GET request

    127.0.0.1:8008/uuid

You can test the project with pytest by running the command. You can check Github Actions for the status of tests here

    pytest

This project id based heavily on this setup Audio Files API

References

  1. deploy_DL_project Repository. link
  2. FastAPI Documentation. link
  3. Requests Documentation. link
  4. Pytest Documentation. link
  5. Flask Documentation. link