Goyda-Return is a simple task management API built with Go, Gin, and GORM. It allows users to create, update, retrieve, and delete tasks. This project demonstrates best practices in building a RESTful API using Go, with a modular architecture and user-task integration.
- Task Management: Create, read, update, and delete tasks.
- Task Types: Categorize tasks as personal, work, or other.
- User Integration: Each task is associated with a user.
- Validation: Ensures proper validation of request payloads.
- Database Integration: Uses GORM for seamless database interactions.
- Modular Architecture: Built with a modular structure to easily add new features.
Ensure you have the following installed:
- Go (Version 1.20+ recommended)
- PostgreSQL or your preferred database
- Git
-
Clone the repository:
git clone https://github.com/your-username/goyda-return.git cd goyda-return -
Install dependencies:
go mod tidy
-
Configure the database:
- Update the database configuration in
internal/config/config.goto match your database credentials.
- Update the database configuration in
-
Start the server:
go run main.go
| Method | Endpoint | Description |
|---|---|---|
GET |
/tasks |
Retrieve all tasks |
GET |
/tasks/:id |
Retrieve a task by ID |
POST |
/tasks |
Create a new task |
PUT |
/tasks/:id |
Update a task |
DELETE |
/tasks/:id |
Delete a task |
| Method | Endpoint | Description |
|---|---|---|
POST |
/users |
Create a new user |
{
"name": "Buy groceries",
"type": "personal",
"done": false,
"user_id": 1
}{
"name": "Buy groceries and cook",
"type": "work",
"done": true
}{
"username": "johndoe",
"email": "johndoe@example.com",
"password": "securepassword"
}goyda-return/
│
├── internal/ # Internal modules
│ ├── config/ # Configuration files
│ │ └── config.go # Database and app configuration
│ ├── modules/ # Modules for tasks and users
│ │ ├── core/ # Core utilities
│ │ ├── tasks/ # Task module (controller, service, model, etc.)
│ │ │ ├── ctrl/ # Task controllers
│ │ │ ├── dto/ # Task DTOs
│ │ │ ├── ent/ # Task entities (GORM models)
│ │ │ ├── svc/ # Task services
│ │ │ └── router.task.go # Task routes
│ │ ├── users/ # User module (controller, service, model, etc.)
│ │ │ ├── ctrl/ # User controllers
│ │ │ ├── dto/ # User DTOs
│ │ │ ├── ent/ # User entities (GORM models)
│ │ │ ├── svc/ # User services
│ │ │ └── router.user.go # User routes
│ ├── utils/ # Utility files
│ │ └── validator.go # Validation logic
├── main.go # Entry point for the application
├── README.md # Project documentation
Contributions are welcome! Please fork the repository, make your changes, and submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
This updated README should now align with your project's structure, reflecting the correct paths and modular setup. Let me know if you'd like to make any further adjustments!