/fastapi-template

FastAPI backend framework template

Primary LanguagePython

Backend API

폴더 구성

.
    └── app/
        ├── api/
        │   ├── music/
        │   │   ├── controller.py: API endpoint
        │   │   ├── schemas.py: Type model, enum
        │   │   ├── services.py: API에서 사용하는 method
        │   └── router.py
        ├── main.py
        ├── settings.py: 환경변수
        └── README.md

Install

  1. Install python environment (pyenv, virtualenv, ...)
  2. Install poetry, fastapi, uvicorn
$ pip(pip3) install poetry fastapi uvicorn
  1. Install packages
$ poetry install

서버 실행 방법

  1. app folder로 이동
$ cd app
  1. 서버 실행
app$ uvicorn main:app --reload
  1. Swagger UI URL
http://localhost:8000/docs