https://github.com/madihanazir/students-api
Students API is a lightweight and efficient RESTful API built with Go and SQLite, designed to manage student records. It provides essential CRUD operations (Create, Read, Update, Delete) along with a HEAD request to check if a student exists without fetching their full details.
https://github.com/madihanazir/students-api
backend backend-api golang restful-api sqlite tableplus
Last synced: 3 months ago
JSON representation
Students API is a lightweight and efficient RESTful API built with Go and SQLite, designed to manage student records. It provides essential CRUD operations (Create, Read, Update, Delete) along with a HEAD request to check if a student exists without fetching their full details.
- Host: GitHub
- URL: https://github.com/madihanazir/students-api
- Owner: madihanazir
- Created: 2025-02-22T10:58:11.000Z (4 months ago)
- Default Branch: master
- Last Pushed: 2025-02-22T11:46:49.000Z (4 months ago)
- Last Synced: 2025-02-22T12:18:29.316Z (4 months ago)
- Topics: backend, backend-api, golang, restful-api, sqlite, tableplus
- Language: Go
- Homepage:
- Size: 22.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 📚 Students API
A simple RESTful API to manage students using SQLite as the database. This project implements basic CRUD operations (Create, Read, Update, Delete) along with additional HTTP methods like `HEAD` to check if a student exists.
## ✨ Features
- **Create**: Add a new student.
- **Read**: Retrieve student details by ID or list all students.
- **Update**: Modify an existing student's details.
- **Delete**: Remove a student from the database.
- **Existence Check**: Use the `HEAD` request to verify if a student exists without retrieving full data.---
## ⚙️ PrerequisitesBefore running the project, ensure you have:
- [Go](https://golang.org/doc/install) (version 1.18+).
- SQLite3 installed for database management.
- [Postman](https://www.postman.com/) or any HTTP client for API testing.---
## 🚀 Installation### 1️⃣ Clone the Repository
```sh```
git clone https://github.com/madihanazir/students-api.git
cd students-api
### 2️⃣ Install Dependenciesgo mod tidy
### 3️⃣ SQLite Setup
SQLite is used as the database, and the required tables will be created automatically when the application runs.If you want to inspect the database or perform manual queries, install SQLite by following the instructions here.
### ⚙️ Configuration
The project supports configuration via a .env file. Create one and add the following environment variables (optional):
Edit
HTTP_SERVER_ADDR=":8080"
STORAGE_PATH="storage/storage.db"### ▶️ Running the Application
Start the API server with:
go run cmd/main.go
The API will be available at: http://localhost:8080.### 🛠️ API Testing with Postman
✅ Install Postman
Download and install Postman.
✅ How to Use Postman for API Testing
Start the server:go run cmd/main.go
Send API requests:# Use Postman to make GET, POST, PUT, DELETE, and HEAD requests to test the API.
### 🗄️ Database Setup & Visualization
Option 1: Using TablePlus (Recommended)
Download TablePlus for your OS.
Open TablePlus and click "Create a new connection".
Select "SQLite", then choose storage/storage.db.
Click "Connect" to explore and manage the database visually.
### 📬 Contact
For any questions or suggestions, feel free to reach out:
📧 [email protected]