https://github.com/augsmachado/students-list
This project is a simple RESTful API built with FastAPI for managing student data
https://github.com/augsmachado/students-list
fastapi python
Last synced: 2 months ago
JSON representation
This project is a simple RESTful API built with FastAPI for managing student data
- Host: GitHub
- URL: https://github.com/augsmachado/students-list
- Owner: augsmachado
- License: apache-2.0
- Created: 2025-02-21T20:13:47.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-10-28T22:02:04.000Z (8 months ago)
- Last Synced: 2025-12-09T09:19:57.622Z (7 months ago)
- Topics: fastapi, python
- Language: Python
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
# Students List - FastApi
## Overview
This project is a simple RESTful API built with FastAPI for managing student data. It uses an in-memory dictionary to store student information, including name, age, and year. The project demonstrates basic CRUD operations with FastAPI and serves as a starting point for building more complex APIs.
## 🚀 Features
The API provides the following endpoints:
- **GET/**: Returns a welcome message "First Data".
- **GET/status**: Returns the API name and version.
- **GET/get-student/{student_id}**: Retrieves a student by their ID using a path parameter. Returns a "Student not found" message if the ID doesn't exist.
- **GET/get-by-name**: Retrieves a student by their name using a query parameter. Returns a "Student not found" message if the name doesn't exist.
- **POST/create-student/{student_id}**: Creates a new student with the given ID. Returns a "Student already exists" message if the ID is already in use. Accepts a JSON payload with student data.
- **PUT/update-student/{student_id}**: Updates an existing student's information. Accepts a JSON payload with optional fields for name, age, and year. Returns a "Student not found" message if the ID doesn't exist.
- **DELETE/delete-student/{student_id}**: Deletes a student by their ID. Returns a "Student deleted successfully" message upon successful deletion or a "Student not found" message if the ID doesn't exist.
The API uses Pydantic models for data validation and serialization. Student model defines the required fields for creating a student, while UpdateStudent allows optional fields for updating.
## 🛠 Tech Stack
- Python 3.11
- FastAPI
## 📦 Prerequisites
- Python 3.11+
- pip
## 🔧 Installation
### 1. Clone Repository
```bash
git clone https://github.com/augsmachado/students-list.git
cd students-list
```
### 2. Create Virtual Environment
```bash
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
```
### 3. Install Dependencies
```bash
pip install -r requirements.txt
```
### 🚦 Running the Application
```bash
uvicorn main:app --reload
```
### 🔍 Testing
```bash
pytest
```
### 🤝 Contributing
Feel free to submit issues or pull requests for improvements or bug fixes. Use the framework below:
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
### 📄 License
This project is licensed under the Apache License 2.0.
See the LICENSE file for details.