Home

Awesome

FastAPI demo project

Travis PyUp MIT License Code Style LinkedIn

<br /> <p align="center"> <a href="https://github.com/sandervandorsten/azure-iothub-demo"> <img src="docs/assets/imgs/FastAPI-logo-teal.png" alt="Logo" height="80"> </a> <h3 align="center">FastAPI Demo</h3> <p align="center"> REST API built with FastAPI on top of mock-up JSON dataset <br /> <br /> <a href="https://github.com/sandervandorsten/azure-iothub-demo/issues">Report Bug</a> · <a href="https://github.com/sandervandorsten/azure-iothub-demo/issues">Request Feature</a> </p> </p>

Features

Installation

# Create a virtual Environment
virtualenv -p $(which python3.7) venv
source venv/bin/activate
# Install packages
$ make install
...
Finished processing dependencies for chinook-fastapi
# Serve the API
$ make serve-api
cd chinook_fastapi && uvicorn api:app --reload
INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO:     Started reloader process [...] using statreload
INFO:     Started server process [...]
INFO:     Waiting for application startup.
INFO:     Application startup complete.

Usage

Using a browser (or you favorite API client, I use Insomnia), go to localhost:8000/docs to see the available API methods.

e.g:

curl --request GET \
  --url http://localhost:8000/users/4 \
  --header 'content-type: application/json'

would return

{
  "first_name": "Willard",
  "last_name": "Valek",
  "email": "wvalek3@vk.com",
  "gender": "Male",
  "ip_address": "67.76.188.26"
}

TODO

Contact

Sander van Dorsten sandervandorsten@gmail.com

<hr> <small>

This package was created with Cookiecutter and the audrey/cookiecutter-pypackage project template.

</small>