cmpadden / simple-fastapi-postgres

Simple demonstration of configuring FastAPI and Postgres w/ Docker Compose

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple FastAPI Postgres Starter

A very basic example of running FastAPI and Postgres with Docker Compose.

Usage

Build and instantiate the containers:

docker-compose up -d --build

Connect to the Postgres instance running in the db container:

docker-compose exec db psql --username=fastapi_traefik --dbname=fastapi_traefik

Hit the endpoint using curl / httpie:

http localhost:8000

HTTP/1.1 200 OK
content-length: 48
content-type: application/json
date: Sun, 17 Sep 2023 19:05:28 GMT
server: uvicorn

[
    {
        "active": true,
        "email": "test@test.com",
        "id": 1
    }
]

References

The scaffolding of this project is a simplified version of fantastic tutorial provided by testdriven.io.

About

Simple demonstration of configuring FastAPI and Postgres w/ Docker Compose


Languages

Language:Python 89.0%Language:Dockerfile 11.0%