Skip to content
プロジェクト

0xTheProDev/fastapi-clean-example

GitHubで見る

概要

FastAPIフレームワークを使ったクリーンアーキテクチャのサンプルです。

Web・アプリ開発

この数値の測り方

計測したスター増加

24時間
0
7日間
0
15日間
0
1か月
履歴を収集中

期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。

fastapi-clean-example

Python FastAPI OpenAPI Swagger GraphQL Code style: black Typed with: pydantic Open Issues Closed Issues Open Pulls Closed Pulls Contributors Activity

Description

Example Application Interface using FastAPI framework in Python 3

This example showcases Repository Pattern in Hexagonal Architecture (also known as Clean Architecture). Here we have two Entities - Books and Authors, whose relationships have been exploited to create CRUD endpoint in REST under OpenAPI standard.

Installation

  • Install all the project dependency using Pipenv:

    $ pipenv install --dev
    
  • Run the application from command prompt:

    $ pipenv run uvicorn main:app --reload
    
  • You can also open a shell inside virtual environment:

    $ pipenv shell
    
  • Open localhost:8000/docs for API Documentation

  • Open localhost:8000/graphql for GraphQL Documentation

Note: In case you are not able to access pipenv from you PATH locations, replace all instances of pipenv with python3 -m pipenv.

Testing

For Testing, unittest module is used for Test Suite and Assertion, whereas pytest is being used for Test Runner and Coverage Reporter.

  • Run the following command to initiate test:
    $ pipenv run pytest
    
  • To include Coverage Reporting as well:
    $ pipenv run pytest --cov-report xml --cov .
    

License

© MIT License

関連プロジェクトを探す

読み込み中…