{"id":29565625,"url":"https://github.com/michaelwp/gobin","last_synced_at":"2025-12-31T14:31:31.482Z","repository":{"id":300216906,"uuid":"1002854645","full_name":"michaelwp/gobin","owner":"michaelwp","description":null,"archived":false,"fork":false,"pushed_at":"2025-06-20T12:34:35.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-20T13:35:35.887Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michaelwp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2025-06-16T08:45:46.000Z","updated_at":"2025-06-20T12:34:38.000Z","dependencies_parsed_at":"2025-06-20T13:35:37.340Z","dependency_job_id":"1b82052c-3506-44ec-bde4-ec44234a3ed7","html_url":"https://github.com/michaelwp/gobin","commit_stats":null,"previous_names":["michaelwp/gobin"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/michaelwp/gobin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwp%2Fgobin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwp%2Fgobin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwp%2Fgobin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwp%2Fgobin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaelwp","download_url":"https://codeload.github.com/michaelwp/gobin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwp%2Fgobin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265837734,"owners_count":23836558,"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":[],"created_at":"2025-07-18T21:34:57.774Z","updated_at":"2025-12-31T14:31:31.458Z","avatar_url":"https://github.com/michaelwp.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gobin\n\n**gobin** is a simple pastebin app. It allows users to quickly and easily share text or code snippets online. The app is designed to be lightweight, fast, and easy to use, making it ideal for sharing temporary notes, code, or any other text content.\n\n## Features\n- Create and share text or code snippets instantly\n- Minimal and user-friendly interface\n- Fast and lightweight\n- RESTful API with comprehensive documentation\n- **Direct URL access**: Access pastes directly via URL (e.g., `http://localhost:8080/{key}`)\n\n## Getting Started\n\n1. Clone the repository:\n   ```sh\n   git clone https://github.com/michaelwp/gobin.git\n   cd gobin\n   ```\n2. Build and run the application:\n   ```sh\n   go build -o gobin cmd/main.go\n   ./gobin\n   ```\n\n## API Documentation\n\n### Generate Swagger Documentation\n\n1. Install swag CLI tool:\n   ```bash\n   go install github.com/swaggo/swag/cmd/swag@latest\n   ```\n\n2. Add to PATH (if not already added):\n   ```bash\n   export PATH=$PATH:~/go/bin\n   ```\n\n3. Generate the documentation:\n   ```bash\n   swag init -g cmd/main.go\n   ```\n\n### Access Swagger UI\n\nOnce your application is running, you can access the interactive API documentation:\n\n- **Swagger UI**: `http://localhost:8080/swagger/index.html`\n- **Raw JSON spec**: `http://localhost:8080/swagger/doc.json`\n\n### API Endpoints\n\n#### Health Check\n- **GET** `/api/healthcheck`\n- **Description**: Check if the API is running and healthy\n- **Response**: Returns a success message with status 200\n\n#### Create New Paste\n- **POST** `/api/v1/pastes/add`\n- **Description**: Create a new paste with the provided content and expiration date\n- **Content-Type**: `application/json`\n- **Request Body**:\n  ```json\n  {\n    \"content\": \"Your text or code content here\",\n    \"expires\": \"2024-12-31\"\n  }\n  ```\n- **Response**: Returns the generated key for accessing the content\n- **Status Codes**:\n  - `200`: Content successfully added\n  - `400`: Bad request (invalid request body)\n  - `500`: Internal server error\n\n#### Retrieve Content\n- **GET** `/api/v1/pastes/{key}`\n- **Description**: Retrieve content by its unique key\n- **Parameters**:\n  - `key` (path, required): The unique identifier for the paste\n- **Response**: Returns the stored content\n- **Status Codes**:\n  - `200`: Content successfully retrieved\n  - `404`: Content not found\n  - `500`: Internal server error\n\n### Data Models\n\n#### AddRequest\n```json\n{\n  \"content\": \"string\",  // The content to be stored\n  \"expires\": \"string\"   // Expiration date in YYYY-MM-DD format\n}\n```\n\n#### Response\n```json\n{\n  \"status\": \"string\",   // \"success\" or \"error\"\n  \"message\": \"string\",  // Description of the result\n  \"data\": {}           // Optional response data\n}\n```\n\n### Example Usage\n\n#### Create a new paste\n```bash\ncurl -X POST http://localhost:8080/api/v1/pastes/add \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"content\": \"Hello, World! This is my first paste.\",\n    \"expires\": \"2024-12-31\"\n  }'\n```\n\n**Response**:\n```json\n{\n  \"status\": \"success\",\n  \"message\": \"content successfully added\",\n  \"data\": {\n    \"key\": \"abc123\"\n  }\n}\n```\n\n#### Retrieve content\n```bash\ncurl http://localhost:8080/api/v1/pastes/abc123\n```\n\n**Response**:\n```json\n{\n  \"status\": \"success\",\n  \"message\": \"get content successfully\",\n  \"data\": {\n    \"content\": \"Hello, World! This is my first paste.\"\n  }\n}\n```\n\n#### Health check\n```bash\ncurl http://localhost:8080/api/healthcheck\n```\n\n**Response**:\n```json\n{\n  \"status\": \"success\",\n  \"message\": \"hello world\"\n}\n```\n\n## Usage\n- Open your browser and navigate to the app's URL (e.g., `http://localhost:8080`).\n- Paste your text or code and submit to get a shareable link.\n- Use the Swagger UI to explore and test the API endpoints.\n\n## Direct URL Access\n\nOne of the key features of gobin is the ability to access pastes directly via URL. This makes sharing content extremely simple:\n\n### How it works\n1. **Create a paste** using the web interface or API\n2. **Get the key** (e.g., `abc123`)\n3. **Share the direct URL**: `http://localhost:8080/abc123`\n\n### Benefits\n- **No need to copy/paste keys**: Just share the URL directly\n- **Bookmarkable**: Users can bookmark paste URLs for later access\n- **Clean URLs**: Simple, readable URLs without query parameters\n- **Mobile-friendly**: Works seamlessly on mobile devices\n\n### Example\n1. Create a paste with content \"Hello World\"\n2. Receive key: `xyz789`\n3. Share URL: `http://localhost:8080/xyz789`\n4. Anyone with the URL can access the content directly\n\nThe web interface also shows the direct URL when you retrieve a paste, making it easy to copy and share.\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelwp%2Fgobin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaelwp%2Fgobin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelwp%2Fgobin/lists"}