{"id":22729467,"url":"https://github.com/bartzalewski/file-upload-service","last_synced_at":"2025-03-30T00:44:30.446Z","repository":{"id":265710187,"uuid":"806714842","full_name":"bartzalewski/file-upload-service","owner":"bartzalewski","description":"This project provides a backend service for uploading and managing files with user authentication and file access controls.","archived":false,"fork":false,"pushed_at":"2024-05-27T18:45:23.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T03:25:54.684Z","etag":null,"topics":["file-upload","go","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bartzalewski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-27T18:41:01.000Z","updated_at":"2024-05-27T18:45:42.000Z","dependencies_parsed_at":"2024-12-02T07:15:45.326Z","dependency_job_id":null,"html_url":"https://github.com/bartzalewski/file-upload-service","commit_stats":null,"previous_names":["bartzalewski/file-upload-service"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartzalewski%2Ffile-upload-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartzalewski%2Ffile-upload-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartzalewski%2Ffile-upload-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartzalewski%2Ffile-upload-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bartzalewski","download_url":"https://codeload.github.com/bartzalewski/file-upload-service/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246262488,"owners_count":20749171,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["file-upload","go","golang"],"created_at":"2024-12-10T18:10:03.060Z","updated_at":"2025-03-30T00:44:30.429Z","avatar_url":"https://github.com/bartzalewski.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# File Upload Service\n\nWelcome to the File Upload Service! This project provides a backend service for uploading and managing files with user authentication and file access controls.\n\n## Features\n\n- User authentication with JWT tokens\n- Secure password storage using bcrypt\n- File upload and download\n- Access control based on user authentication\n\n## Getting Started\n\nFollow these instructions to get a copy of the project up and running on your local machine for development and testing purposes.\n\n### Prerequisites\n\nEnsure you have the following installed on your system:\n\n- [Go](https://golang.org/doc/install) (version 1.16+)\n- [Git](https://git-scm.com/)\n\n### Installation\n\n1. **Clone the repository**:\n\n   ```sh\n   git clone https://github.com/bartzalewski/file-upload-service.git\n   cd file-upload-service\n   ```\n\n2. **Initialize Go modules**:\n\n   ```sh\n   go mod tidy\n   ```\n\n3. **Run the application**:\n\n   ```sh\n   go run main.go\n   ```\n\nThe server will start on `http://localhost:8080`.\n\n### Directory Setup\n\nThe service will automatically create an `uploads` directory for storing uploaded files.\n\n## API Endpoints\n\n### User Authentication\n\n#### Sign Up\n\n- **Endpoint**: `POST /signup`\n- **Request Body**:\n  ```json\n  {\n    \"username\": \"your-username\",\n    \"password\": \"your-password\"\n  }\n  ```\n- **Response**:\n  ```json\n  {\n    \"status\": \"User created successfully\"\n  }\n  ```\n\n#### Sign In\n\n- **Endpoint**: `POST /signin`\n- **Request Body**:\n  ```json\n  {\n    \"username\": \"your-username\",\n    \"password\": \"your-password\"\n  }\n  ```\n- **Response**:\n  ```json\n  {\n    \"status\": \"Signed in successfully\"\n  }\n  ```\n  A `token` cookie is set upon successful sign-in.\n\n### File Management\n\n#### Upload File\n\n- **Endpoint**: `POST /upload`\n- **Request**: Form-data with file field named `file`\n- **Response**:\n  ```json\n  {\n    \"filename\": \"uploaded-file-name.txt\",\n    \"uploaded_at\": \"2023-05-24T12:34:56Z\",\n    \"uploader\": \"your-username\"\n  }\n  ```\n\n#### Download File\n\n- **Endpoint**: `GET /files/{filename}`\n- **Response**: The requested file is served for download.\n\n## Testing the Service\n\nUse tools like `curl` or Postman to test the endpoints.\n\n### Example Requests\n\n1. **Sign Up**:\n\n   ```sh\n   curl -X POST -d '{\"username\":\"testuser\", \"password\":\"password\"}' -H \"Content-Type: application/json\" http://localhost:8080/signup\n   ```\n\n2. **Sign In**:\n\n   ```sh\n   curl -X POST -d '{\"username\":\"testuser\", \"password\":\"password\"}' -H \"Content-Type: application/json\" http://localhost:8080/signin -c cookies.txt\n   ```\n\n3. **Upload File**:\n\n   ```sh\n   curl -X POST -F 'file=@path/to/your/file.txt' http://localhost:8080/upload -b cookies.txt\n   ```\n\n4. **Download File**:\n\n   ```sh\n   curl -O http://localhost:8080/files/file.txt -b cookies.txt\n   ```\n\n## Built With\n\n- [Go](https://golang.org/) - The Go programming language\n- [Gorilla Mux](https://github.com/gorilla/mux) - A powerful URL router and dispatcher for Golang\n- [JWT-Go](https://github.com/dgrijalva/jwt-go) - A Go implementation of JSON Web Tokens\n- [Bcrypt](https://pkg.go.dev/golang.org/x/crypto/bcrypt) - A package for password hashing\n\n## Contributing\n\nFeel free to submit issues or pull requests. For major changes, please open an issue first to discuss what you would like to change.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\n- Thanks to the Go community for their invaluable resources and support.\n- [Gorilla Mux](https://github.com/gorilla/mux) and [JWT-Go](https://github.com/dgrijalva/jwt-go) for making development easier.\n\n---\n\nHappy coding! 🚀\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbartzalewski%2Ffile-upload-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbartzalewski%2Ffile-upload-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbartzalewski%2Ffile-upload-service/lists"}