{"id":27121971,"url":"https://github.com/seyf97/blogapi","last_synced_at":"2025-07-15T11:41:54.028Z","repository":{"id":262855096,"uuid":"888544755","full_name":"seyf97/BlogAPI","owner":"seyf97","description":"Simple Go-based RESTful API built with the Gin framework, serving as the backend for a blog.","archived":false,"fork":false,"pushed_at":"2024-11-14T17:55:32.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-07T09:54:59.624Z","etag":null,"topics":["gin-gonic","go","golang","jwt","rest-api"],"latest_commit_sha":null,"homepage":"","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/seyf97.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}},"created_at":"2024-11-14T15:26:04.000Z","updated_at":"2024-11-14T18:05:14.000Z","dependencies_parsed_at":"2024-11-14T17:36:16.971Z","dependency_job_id":null,"html_url":"https://github.com/seyf97/BlogAPI","commit_stats":null,"previous_names":["seyf97/blogapi"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/seyf97/BlogAPI","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seyf97%2FBlogAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seyf97%2FBlogAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seyf97%2FBlogAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seyf97%2FBlogAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seyf97","download_url":"https://codeload.github.com/seyf97/BlogAPI/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seyf97%2FBlogAPI/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265432921,"owners_count":23764186,"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":["gin-gonic","go","golang","jwt","rest-api"],"created_at":"2025-04-07T11:23:12.440Z","updated_at":"2025-07-15T11:41:53.761Z","avatar_url":"https://github.com/seyf97.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BlogAPI\nThis project is a simple Go-based RESTful API built with the Gin framework, serving as the backend for a blog. It offers endpoints for managing blog posts and includes authentication, enabling creation, reading, updating, and deletion (CRUD) of entries.\n\n## Installation\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/seyf97/BlogAPI.git\n   cd BlogAPI\n   ```\n\n2. Create a `.env` file in the project root with the following fields:\n   ```\n   PORT=your_port_number\n   JWT_SECRET=your_jwt_secret\n   ```\n   - `PORT`: Specifies the port the server will run on (e.g. 8080)\n   - `JWT_SECRET`: Secret key used for signing JWT tokens\n\n3. Install dependencies:\n   ```bash\n   go mod download\n   ```\n\n4. Run the application:\n   ```bash\n   go run main.go\n   ```\n\n\n## Features\n\n- **JWT Authentication**  \n  Secure user authentication using JSON Web Tokens (JWT).\n\n- **CRUD Operations for Articles**  \n  Supports Creating, Reading, Updating, and Deleting articles.\n\n- **User Management**  \n  Allows user signup and login functionality.\n\n- **SQLite Database**  \n  Utilizes SQLite as the database backend for lightweight and easy data storage.\n\n\n## API Endpoints\n\n### Articles\n\n| Method | Route                  | Auth Required | Description                 |\n|--------|------------------------|---------------|-----------------------------|\n| GET    | `/articles/:id`        | No            | Get a single article by ID  |\n| GET    | `/articles`            | No            | Get all articles            |\n| POST   | `/articles`            | Yes           | Create a new article        |\n| DELETE | `/articles/:id`        | Yes           | Delete an article by ID     |\n| PUT    | `/articles/:id`        | Yes           | Update an article by ID     |\n\n### Users\n\n| Method | Route     | Description                  |\n|--------|-----------|------------------------------|\n| POST   | `/signup` | Register a new user          |\n| POST   | `/login`  | Authenticate user and get token |\n\n\n## Structure\n\n```plaintext\nBlogAPI/\n├── db/\n│   └── db.go                  // DB connection and operations\n├── middlewares/\n│   └── auth.go                // JWT authentication middleware\n├── models/\n│   ├── article.go             // Article model and data handling\n│   └── user.go                // User model and data handling\n├── routes/\n│   ├── articles.go            // Routes for article-related endpoints\n│   ├── routes.go              // Contains all routes\n│   └── users.go               // Routes for user-related endpoints\n├── utils/\n│   ├── hash.go                // Utility for password hashing\n│   └── jwt.go                 // Utility for JWT generation and validation\n├── .gitignore                 \n├── go.mod                     \n├── go.sum                     \n├── LICENSE                    \n├── main.go                    // Main entry point of the application\n└── README.md                 \n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseyf97%2Fblogapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseyf97%2Fblogapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseyf97%2Fblogapi/lists"}