From ee3c4c0452b904f9c9d74037936810bf3e40f1e2 Mon Sep 17 00:00:00 2001 From: Julian Mutter Date: Fri, 23 Jan 2026 19:57:03 +0100 Subject: [PATCH] Add .gitignore and README --- .gitignore | 1 + README.md | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 .gitignore create mode 100644 README.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..29963da --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/.direnv/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..5de8998 --- /dev/null +++ b/README.md @@ -0,0 +1,74 @@ +# 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 user +- `POST /auth/login` - Login and get JWT token + +### Music Sheets (requires authentication) +- `POST /api/sheets/upload` - Upload a PDF music sheet +- `GET /api/sheets` - List all music sheets +- `GET /api/sheets/download/:id` - Download a specific sheet + +## Development Setup + +1. Enter the development environment: + ```bash + nix develop + ``` + +2. Download dependencies: + ```bash + go mod tidy + ``` + +3. Run the server: + ```bash + go run main.go + ``` + +## Building + +To build the project: +```bash +go build -o sheetless-server main.go +``` + +## Usage Examples + +### Register a user: +```bash +curl -X POST http://localhost:8080/auth/register \ + -H "Content-Type: application/json" \ + -d '{"username":"testuser","email":"test@example.com","password":"password123"}' +``` + +### Login: +```bash +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): +```bash +curl -X POST http://localhost:8080/api/sheets/upload \ + -H "Authorization: Bearer TOKEN" \ + -F "title=My Sheet" \ + -F "file=@sheet.pdf" +``` + +### List sheets: +```bash +curl -H "Authorization: Bearer TOKEN" http://localhost:8080/api/sheets +``` \ No newline at end of file