Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

FastAPI REST API with Docker

This project is a simple REST API built using FastAPI and docker. It provides endpoints for managing customers and invoices.

Features

  • CRUD operations for customers and invoices.
  • Containerized FastAPI application using Docker.
  • Fake in-memory database storage using Python dictionaries.
  • Defined Pydantic models for validation and serialization.

Getting Started

Prerequisites

Installation

  1. Clone the repository:

    git clone  Working-with-fastAPI
    cd Working-with-fastAPI
  2. Build the Docker image:

    docker build -t fastapi_image .
Screenshot 2023-09-09 040827
  1. Run the container:

    docker run -d -p 8000:80 fastapi_image
Screenshot 2023-09-09 040808
  1. Visit http://localhost:8000 in your browser to see the API in action.
Screenshot 2023-09-09 040915
  1. visit http://127.0.0.1:8000/docs#/ to see the requests built.
Screenshot 2023-09-09 041007

API Endpoints

Here's a quick overview of the available endpoints:

  • GET /: Base URL which returns a welcome message.
  • POST /customer: Create a new customer.
  • GET /customer/{customer_id}: Fetch details of a specific customer by their ID.
  • POST /customer/{customer_id}/invoice: Create a new invoice for a customer.
  • GET /customer/{customer_id}/invoice: Retrieve all invoices for a specific customer.
  • GET /invoice/{invoice_no}: Fetch details of a specific invoice.
  • GET /invoice/{invoice_no}/{stockcode}/: Fetch a specific stock code on the invoice.
  • POST /invoice/{invoice_no}/{stockcode}/: Add a stock code to the invoice.

Built With

  • FastAPI - Modern, fast web framework for building APIs with Python 3.7+.
  • Docker - Containerization and deployment.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages