/pydantic-poc

This is just a simple pydantic + FastAPI PoC

Primary LanguageMakefileMIT LicenseMIT

PoC pydantic + FastAPI

This project is just a quick test about how to use pydantic and FastAPI together

Getting Started

Install

I recomend you to use a python version management, for example pyenv, This project is commanded by pipenv from the standing point of view of the dependency management.

pip install pipenv
pipenv install --dev

Running the app

pipenv run app/main.py

Configuration

Property Type Default value
HOST str 0.0.0.0
PORT int 8000

For example, if you want to change the default port, you just need to make something like this:

PORT=5555 pipenv run app/main.py

Docker way

  1. Build the app Docker image
make docker/build
  1. Run the app container
make docker/start
  1. Stop the app container (be careful sometimes your docker engine could has some dangling containers, and you have to delete them)
make docker/stop

Of course you can modify the configuration of the application using the environment variables, for example:

HOST="127.0.0.1" PORT=5555 make docker/start

Development mode

Having a fresh installation of the depencies in place, this will allow you to play inside the virtual environment

pipenv shell

For a complete reference of the operations availabe just execute:

make help