Skip to content

Latest commit

 

History

History
44 lines (27 loc) · 901 Bytes

README.md

File metadata and controls

44 lines (27 loc) · 901 Bytes

FastAPI_OpenAPI

An example project for generating a FastAPI Python server from an OpenApi file.

Install requirements

For generating the server from the OpenApi file we will need a generator. Here we use the fastapi-code-generator

pip install fastapi-code-generator

To run the application we will use the Uvicorn package:

pip install unicorn

And for the Server we will need the fastAPI package:

pip install fastapi

Generate Server

To generate the server simply use the following command:

fastapi-codegen --input .\open_api\pet_shop_api.json --output app

After this you will found all the generated files (main.py and models.py) under the app folder.

Run Server

To run the server just run:

cd app
uvicorn main:app --reload