Skip to content

Vipul99999/FastAPI-Learning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastAPI Learning Project

This repository contains a basic API built with FastAPI, a modern Python framework for building high-performance web applications and APIs.
The project demonstrates how to set up a FastAPI app, run it locally, and explore the automatically generated Swagger UI.


🚀 Features

  • Built with FastAPI (Python 3.12+)
  • Automatic interactive API docs using Swagger UI (/docs)
  • Type-safe request/response validation with Pydantic
  • Runs on Uvicorn ASGI server

📂 Project Structure

D:\Projects_Components\FastAPI\Basic_API
│── main.py          # FastAPI application entry point
│── requirements.txt # Dependencies
│── README.md        # Project documentation

⚙️ Setup Instructions

1. Create Virtual Environment

python -m venv myenv

2. Activate Virtual Environment

  • PowerShell:
    .\myenv\Scripts\Activate.ps1
  • Command Prompt (cmd.exe):
    myenv\Scripts\activate.bat

3. Install Dependencies

pip install fastapi uvicorn

4. Run the Application

uvicorn main:app --reload

🌐 Accessing the API

  • Base URL: http://127.0.0.1:8000
  • Swagger UI (interactive docs): http://127.0.0.1:8000/docs
  • ReDoc docs: http://127.0.0.1:8000/redoc

📌 Example Endpoint

from fastapi import FastAPI

app = FastAPI()

@app.get("/")
def read_root():
    return {"message": "Hello, FastAPI!"}

@app.get("/items/{item_id}")
def read_item(item_id: int):
    return {"item_id": item_id}

📝 Notes

  • This project is for learning purposes and exploring FastAPI basics.
  • You can extend it with database integration, authentication, or more complex routes.
  • The auto-generated docs are available at /docs once the server is running.

📖 References

About

A dedicated space for exploring the FastAPI framework, covering basic routing, Pydantic models, and asynchronous API development.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages