This is a FastAPI-based CRUD API for managing student records. The API uses SQLite for database storage and provides endpoints for creating, reading, updating, and deleting student records. It also includes a simple frontend to interact with the API.
- Create a new student record
- Retrieve student details
- Update an existing student record
- Delete a student record
- Swagger documentation enabled by default
- SQLite database for persistence
- FastAPI
- SQLite
- SQLAlchemy
- Uvicorn
- HTML, JavaScript (for frontend)
- Python 3.7+
- pip installed
- Clone this repository:
git clone https://github.com/your-repo/scsu-student-api.git cd scsu-student-api - Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate # Mac/Linux venv\Scripts\activate # Windows
- Install dependencies:
pip install -r requirements.txt
- Run the API server:
uvicorn main:app --reload
- Open Swagger UI in your browser:
http://127.0.0.1:8000/docs
| Method | Endpoint | Description |
|---|---|---|
| POST | /students |
Create a new student |
| GET | /students/{id} |
Retrieve student details |
| GET | /students |
Retrieve all students |
| PUT | /students/{id} |
Update a student record |
| DELETE | /students/{id} |
Delete a student record |
A simple frontend is provided in index.html. Open it in a browser and ensure the API server is running to interact with student records.
- If you get a
405 Method Not Allowederror, ensure the correct endpoint and method are used. - If you get CORS issues, ensure the middleware is properly configured.
This project is licensed under the MIT License.
Ashesh Nepal - GitHub Profile