Skip to content

igorastashov/web-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastAPI Web Service - Vet Clinic

FastAPI web service for a vet clinic to store and update the information about dogs.

Astashov I.V., 2023.

This service was developed in accordance with the assignment of the DevOps course during study at HSE Master's Programme.

If you would like to use the deployed service on Render see (3) Quick start.

(1) Task

The clinic needs a microservice to store and update information for dogs in accordance with the documentation in OpenAPI format.

(2) Technologies

  • Python 3.11
  • Fast API
  • Postgres
  • SQLAlchemy
  • Uvicorn

(3) Quick start

The service is deployed on Render. See the documentation at the link.

(4) Local Development

  1. Clone this repo and cd into repo directory;
  2. Create a virtual environment: python -m venv venv;
  3. Activate a virtual environment: source venv/Scripts/activate;
  4. Install dependencies: pip install -r requirements.txt;
  5. Run the server: uvicorn main:app --reload;
  6. Access swagger at: http://127.0.0.1:8000/docs .

You can also run the app locally using Docker

  1. Build the image docker build . -t fastapi_app:latest or use docker pull astashoviv/fastapi_app;
  2. Spin up the container docker run -d -p 5555:8000 fastapi_app;
  3. Access swagger at: http://127.0.0.1:5555/docs .

(5) Schema

Dog

  • name
  • kind
  • pk

Timestamp

  • id
  • timestamp

(6) Design API

/

  • GET: Basic information about the app

/post

  • POST: Create a new id and timestamp

/dog

  • POST: Create a new dog

/dog

  • GET: Get a list of all dogs or list of dogs by type

/dog/{pk}

  • GET: Get a dog by pk

/dog/{pk}

  • PATCH: Update a dog by pk

(A) Acknowledgments

This repository borrows partially from Артём Шумейко and Gwendolyn Faraday.

Releases

No releases published

Packages

No packages published