Files
encoach_backend/README.md
2024-11-06 02:07:46 +00:00

1.1 KiB

Run the app

  1. pip install poetry
  2. poetry install
  3. python app.py

Modules

  • api -> endpoints
  • configs -> app configs and constants
  • controllers -> meant for handling exceptions, transforming data or orchestrate complex use cases with several services, for now mostly just calls services directly
  • dtos -> pydantic models used for receiving data and for validation
  • exceptions -> if custom exceptions are needed to throw in services so they can be handled in the controllers to construct some specific http response
  • helpers -> a bunch of lightweight functions grouped by some kind of logic
  • mappers -> to map complex data
  • middlewares -> classes that are run before executing the endpoint code
  • repositories -> interfaces with data stores
  • services -> all the business logic goes here
  • utils -> loose functions used on one-off occasions

Dependency injection

If you want to add new controllers/services/repositories you will have to change app/configs/dependency_injection.py

Also make sure you have @inject on your endpoint when calling these.