Skip to content

API component for the DARA-Assistant

License

Notifications You must be signed in to change notification settings

overflw/darapi

 
 

Repository files navigation

Darapi

Quickstart

Run the app in containers

  • Clone the repo and navigate to the root folder.

  • To run the app using Docker, make sure you've got Docker and Docker Compose V2 installed on your system. From the project's root dirctory, run:

    docker compose up -d

Or, run the app locally

If you want to run the app locally, without using Docker, then:

  • Clone the repo and navigate to the root folder.

  • Create a virtual environment. Here I'm using Python's built-in venv in a Unix system. Run:

    python3.10 -m venv .venv
  • Activate the environment. Run:

    source .venv/bin/activate
  • Go to the folder created by cookie-cutter (default is fastapi-nano).

  • Install the dependencies. Run:

    pip install -r requirements.txt && pip install -r requirements-dev.txt
  • Start the app. Run:

    uvicorn app.main:app --port 5000 --reload

Folder structure

This shows the folder structure of the default template.

fastapi-nano
├── app                                 # primary app folder
│   ├── apis                            # this houses all the API packages
│   │   ├── api_a                       # api_a package
│   │   │   ├── __init__.py             # empty init file to make the api_a folder a package
│   │   │   ├── mainmod.py              # main module of api_a package
│   │   │   └── submod.py               # submodule of api_a package
│   │   └── api_b                       # api_b package
│   │       ├── __init__.py             # empty init file to make the api_b folder a package
│   │       ├── mainmod.py              # main module of api_b package
│   │       └── submod.py               # submodule of api_b package
│   ├── core                            # this is where the configs live
│   │   ├── auth.py                     # authentication with OAuth2
│   │   ├── config.py                   # sample config file
│   │   └── __init__.py                 # empty init file to make the config folder a package
│   ├── __init__.py                     # empty init file to make the app folder a package
│   ├── main.py                         # main file where the fastAPI() class is called
│   ├── routes                          # this is where all the routes live
│   │   └── views.py                    # file containing the endpoints of api_a and api_b
│   └── tests                           # test package
│       ├── __init__.py                 # empty init file to make the tests folder a package
│       ├── test_api.py                 # integration testing the API responses
│       └── test_functions.py           # unit testing the underlying functions
├── dockerfiles                         # directory containing all the dockerfiles
├── .env                                # env file containing app variables
├── docker-compose.yml                  # docker-compose file
├── pyproject.toml                      # pep-518 compliant config file
├── requrements-dev.in                  # .in file to enlist the top-level dev requirements
├── requirements-dev.txt                # pinned dev dependencies
├── requirements.in                     # .in file to enlist the top-level app dependencies
└── requirements.txt                    # pinned app dependencies
✨ 🍰 ✨

About

API component for the DARA-Assistant

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 84.3%
  • Makefile 7.9%
  • Dockerfile 5.1%
  • JavaScript 1.4%
  • Shell 1.3%