Skip to content

Commit fd7764c

Browse files
authored
Update README.md
1 parent 29baef1 commit fd7764c

File tree

1 file changed

+108
-1
lines changed

1 file changed

+108
-1
lines changed

Diff for: README.md

+108-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,108 @@
1-
# GoAPIBlog
1+
# Blogging System API
2+
3+
This project is a RESTful API built in Go language that serves as the backend for a blogging system. It provides endpoints for creating, retrieving, updating, and deleting blog posts.
4+
5+
## Features
6+
7+
- User authentication and authorization using JSON Web Tokens (JWT)
8+
- CRUD operations for blog posts
9+
- Pagination and sorting of blog posts
10+
- Error handling and response formatting
11+
- Input validation and data sanitization
12+
- Logging and request/response middleware
13+
- Database integration using PostgreSQL
14+
15+
## Installation
16+
17+
Make sure you have Go installed on your system. You can download and install it from the official Go website: https://golang.org
18+
19+
Clone the repository:
20+
21+
```bash
22+
git clone https://github.com/your-username/blogging-api.git
23+
```
24+
25+
Change to the project directory:
26+
27+
```bash
28+
cd blogging-api
29+
```
30+
31+
Install the project dependencies:
32+
33+
```bash
34+
go mod download
35+
```
36+
37+
Set up the environment variables:
38+
39+
- Create a .env file in the root directory of the project.
40+
41+
- Define the following environment variables in the .env file:
42+
43+
```plaintext
44+
PORT=3000
45+
DB_HOST=your_database_host
46+
DB_PORT=your_database_port
47+
DB_USER=your_database_user
48+
DB_PASSWORD=your_database_password
49+
DB_NAME=your_database_name
50+
JWT_SECRET=your_jwt_secret
51+
```
52+
53+
Build and run the application:
54+
55+
```bash
56+
go build
57+
./blogging-api
58+
```
59+
60+
The API will be accessible at http://localhost:3000 by default. You can change the port in the .env file if necessary.
61+
62+
## API Endpoints
63+
64+
The following endpoints are available in the API:
65+
66+
| Method | Endpoint | Description |
67+
| ---- | -------- | -------- |
68+
| POST | /api/auth/register | Register a new user |
69+
| POST | /api/auth/login | Log in and obtain JWT |
70+
| GET | /api/posts | Get all blog posts |
71+
| POST | /api/posts | Create a new blog post |
72+
| GET | /api/posts/:id | Get a specific blog post |
73+
| PUT | /api/posts/:id | Update a specific blog post |
74+
| DELETE | /api/posts/:id | Delete a specific blog post |
75+
76+
## Database Schema
77+
78+
The application uses a PostgreSQL database with the following schema:
79+
80+
```sql
81+
```
82+
83+
## Dependencies
84+
85+
The project utilizes the following third-party libraries:
86+
87+
- `gin-gonic/gin`: HTTP web framework
88+
- `joho/godotenv`: Environment variable loading
89+
- `dgrijalva/jwt-go`: JWT implementation
90+
- `go-pg/pg`: PostgreSQL ORM
91+
- `go-pg/pgext`: PostgreSQL extensions for go-pg
92+
- `google/uuid`: UUID generation
93+
- `go-playground/validator/v10`: Struct field validation
94+
95+
Make sure to run go mod download as mentioned in the installation steps to fetch these dependencies.
96+
97+
## Contributing
98+
99+
Contributions to this project are welcome. Feel free to open issues and submit pull requests.
100+
101+
## License
102+
103+
This project is licensed under the GPL-3.0 License.
104+
105+
Copyright 2023, Max Base
106+
107+
Copyright 2023, Asrez group
108+

0 commit comments

Comments
 (0)