A scalable social networking platform built with Go and GORM, enabling users to share posts and interact, featuring efficient data modeling, RESTful APIs, and optimized database queries for enhanced performance and user experience.
- User registration with email confirmation and password hashing
- User authentication
- Post creation and sharing
- User interactions
- Efficient data modeling using GORM
- RESTful API endpoints
- Optimized database queries for improved performance
- Go
- GORM (Go Object Relational Mapper)
- RESTful API architecture
- PostgreSQL
- Go
- PostgreSQL
-
Clone the repository:
git clone https://github.com/akumarujon/network-go.git
-
Navigate to the project directory:
cd network-go
-
Install dependencies:
go mod tidy
-
Set up your PostgreSQL database and update the connection string in the configuration file.
-
Run the application:
go run main.go
The network-go application provides the following API endpoints:
/signin
- Sign in to an existing account/signup
- Create a new account/confirm/:token
- Confirm a user account, where:token
is a UUID
GET /
- Retrieve all postsGET /posts/:id
- Get a specific post by IDPATCH /posts/:id
- Update a specific postDELETE /posts/:id
- Delete a specific postPOST /new
- Create a new post
GET /users/:id
- Get a specific user's profilePATCH /users/:id
- Update a user's profileDELETE /users/:id
- Delete a user account
Replace :id
with the actual ID of the post or user you want to interact with.
To use these endpoints, send HTTP requests to the appropriate URL with the necessary data. Make sure to include any required authentication tokens in your requests for protected endpoints.
Keep in mind, that every single route except the ones stated in
Authentication
section requires a UUID token in Headers.
curl http://localhost:8080/ -H "Token: UUID"
curl -X POST -H "Content-Type: application/json" -H "Token: UUID" -d '{"title":"My New Post","content":"This is the content of my post"}' http://localhost:8080/new
curl http://localhost:8080/users/123 -H "Token: UUID"
Replace localhost:8080
with the actual host and port where your application is
running.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.