{"id":22729470,"url":"https://github.com/bartzalewski/blog-api","last_synced_at":"2025-03-30T00:44:31.337Z","repository":{"id":265710179,"uuid":"806707300","full_name":"bartzalewski/blog-api","owner":"bartzalewski","description":"This project is a simple backend for a blogging platform, allowing user management, post creation, and commenting features.","archived":false,"fork":false,"pushed_at":"2024-05-27T18:24:16.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.560Z","etag":null,"topics":["blog","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:20:28.000Z","updated_at":"2024-05-27T18:24:35.000Z","dependencies_parsed_at":"2024-11-30T16:48:57.918Z","dependency_job_id":null,"html_url":"https://github.com/bartzalewski/blog-api","commit_stats":null,"previous_names":["bartzalewski/blog-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartzalewski%2Fblog-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartzalewski%2Fblog-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartzalewski%2Fblog-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bartzalewski%2Fblog-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bartzalewski","download_url":"https://codeload.github.com/bartzalewski/blog-api/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":["blog","go","golang"],"created_at":"2024-12-10T18:10:04.117Z","updated_at":"2025-03-30T00:44:31.311Z","avatar_url":"https://github.com/bartzalewski.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Blog API\n\nWelcome to the Blog API! This project is a simple backend for a blogging platform, allowing user management, post creation, and commenting features.\n\n## Features\n\n- User authentication with JWT tokens\n- CRUD operations for blog posts\n- Adding comments to posts\n- Secure password storage using bcrypt\n- Concurrent safe in-memory storage for users, posts, and comments\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/blog-api.git\n   cd blog-api\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## API Endpoints\n\n### User Authentication\n\n- **Sign Up**\n\n  `POST /signup`\n\n  Request:\n\n  ```json\n  {\n    \"username\": \"your-username\",\n    \"password\": \"your-password\"\n  }\n  ```\n\n  Response:\n\n  ```json\n  {\n    \"status\": \"User created successfully\"\n  }\n  ```\n\n- **Sign In**\n\n  `POST /signin`\n\n  Request:\n\n  ```json\n  {\n    \"username\": \"your-username\",\n    \"password\": \"your-password\"\n  }\n  ```\n\n  Response:\n\n  ```json\n  {\n    \"status\": \"Signed in successfully\"\n  }\n  ```\n\n  Cookie: `token`\n\n### Blog Management\n\n- **Create Post**\n\n  `POST /posts`\n\n  Request:\n\n  ```json\n  {\n    \"title\": \"First Post\",\n    \"content\": \"This is the content of the first post.\"\n  }\n  ```\n\n  Response:\n\n  ```json\n  {\n    \"id\": 1,\n    \"title\": \"First Post\",\n    \"content\": \"This is the content of the first post.\",\n    \"author\": \"your-username\",\n    \"created_at\": \"2023-05-24T12:34:56Z\",\n    \"comments\": []\n  }\n  ```\n\n- **Get Posts**\n\n  `GET /posts`\n\n  Response:\n\n  ```json\n  [\n    {\n      \"id\": 1,\n      \"title\": \"First Post\",\n      \"content\": \"This is the content of the first post.\",\n      \"author\": \"your-username\",\n      \"created_at\": \"2023-05-24T12:34:56Z\",\n      \"comments\": []\n    }\n  ]\n  ```\n\n- **Add Comment**\n\n  `POST /posts/{id}/comments`\n\n  Request:\n\n  ```json\n  {\n    \"content\": \"This is a comment.\"\n  }\n  ```\n\n  Response:\n\n  ```json\n  {\n    \"id\": 1,\n    \"content\": \"This is a comment.\",\n    \"author\": \"your-username\",\n    \"created_at\": \"2023-05-24T12:34:56Z\"\n  }\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%2Fblog-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbartzalewski%2Fblog-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbartzalewski%2Fblog-api/lists"}