5141bfe673574e7be98424d5f3aaff5cd372ab70
Sheetless Server
A Go-based server for hosting and managing PDF music sheets with user authentication.
Features
- User registration and JWT-based authentication
- Upload, list, and download PDF music sheets
- SQLite database for data persistence
- RESTful API with Gin framework
API Endpoints
Authentication
POST /auth/register- Register a new userPOST /auth/login- Login and get JWT token
Music Sheets (requires authentication)
POST /api/sheets/upload- Upload a PDF music sheetGET /api/sheets- List all music sheetsGET /api/sheets/download/:id- Download a specific sheet
Development Setup
-
Enter the development environment:
nix develop -
Download dependencies:
go mod tidy -
Run the server:
go run main.go
Building
To build the project:
go build -o sheetless-server main.go
Usage Examples
Register a user:
curl -X POST http://localhost:8080/auth/register \
-H "Content-Type: application/json" \
-d '{"username":"testuser","email":"test@example.com","password":"password123"}'
Login:
curl -X POST http://localhost:8080/auth/login \
-H "Content-Type: application/json" \
-d '{"username":"testuser","password":"password123"}'
Upload a sheet (replace TOKEN with actual JWT):
curl -X POST http://localhost:8080/api/sheets/upload \
-H "Authorization: Bearer TOKEN" \
-F "title=My Sheet" \
-F "file=@sheet.pdf"
List sheets:
curl -H "Authorization: Bearer TOKEN" http://localhost:8080/api/sheets
Description
Languages
Go
90.4%
Nix
7.5%
Dockerfile
2.1%