Skip to content

PR202111/Apis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

API Project

This project is a FastAPI application with a PostgreSQL database, running entirely in Docker.

Table of Contents


Requirements


Setup

  1. Clone the repository:
git clone https://github.com/PR202111/Apis.git
cd Apis
  1. Build and start the containers:
docker-compose up --build

This will start:

  • api-api (FastAPI server)
  • api-db (PostgreSQL database)

Running the Project

Once the containers are running:

You can stop the containers with:

docker-compose down

Accessing the Database

From inside the API container:

docker exec -it api-api bash
psql -h api-db -U postgres -d mydatabase

From your local machine (optional, requires port mapping):

psql -h localhost -U postgres -d mydatabase

Tables:

\dt;

Sample query:

SELECT * FROM users;

Docker Notes

  • Containers communicate using Docker network, using service names (like api-db) as hostnames.
  • Port mapping (5432:5432) is only needed if you want to access Postgres from your host machine.
  • Database initialization is handled automatically on first startup.

Project Structure

.
├── app/                # FastAPI application code
├── Dockerfile
├── docker-compose.yml
├── requirements.txt
└── README.md

About

This Contains the Bascis for API development in FastApi (pyhton)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors