Students-API is a RESTful backend service built using Go that manages student records. It provides endpoints to create a student, retrieve a student by ID, and list all students. The API includes request validation, structured JSON responses, and uses a lightweight SQLite database for storage.
- Create a new student record
- Fetch a student by ID
- Retrieve all students
- Request validation using structured rules
- JSON-based API responses
- Lightweight and fast SQLite database
- Clean configuration and logging setup
- Language: Go
- API / Server:
net/http(ServeMux routing) - Database: SQLite
database/sqlgithub.com/mattn/go-sqlite3
github.com/go-playground/validator/v10
github.com/ilyakaznacheev/cleanenvgithub.com/joho/godotenv
log/slog
| Method | Endpoint | Description |
|---|---|---|
| POST | /students |
Create a new student |
| GET | /students/{id} |
Get student by ID |
| GET | /students |
List all students |
# Clone the repository
git clone <your-repo-url>
# Navigate to project directory
cd students-api
# Install dependencies
go mod tidy
# Run the server
go run main.go