Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vikashchauhan51/go-sample-api
Web api in golang with Gin farmwork with Clean Architecture principles.
https://github.com/vikashchauhan51/go-sample-api
clean-architecture gin gin-framework gin-swagger go golang
Last synced: about 1 month ago
JSON representation
Web api in golang with Gin farmwork with Clean Architecture principles.
- Host: GitHub
- URL: https://github.com/vikashchauhan51/go-sample-api
- Owner: VikashChauhan51
- License: mit
- Created: 2024-03-03T04:01:02.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-07-28T10:29:21.000Z (5 months ago)
- Last Synced: 2024-07-29T09:57:32.088Z (5 months ago)
- Topics: clean-architecture, gin, gin-framework, gin-swagger, go, golang
- Language: Go
- Homepage:
- Size: 9.87 MB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-sample-api
Web api in golang with Gin farmwork:
```
GO-SAMPLE-API
├───.github # GitHub-specific files
│ └───workflows # CI/CD workflows
├───.vscode # VSCode-specific files and configurations
├───cmd # Application entry points
│ └───api # Main API entry point
│ └───routes # Route configurations for the HTTP server
├───configs # Configuration files
├───docs # Documentation files
├───internal # Private application and library code
│ ├───controllers # HTTP handlers
│ ├───core # Core business logic
│ │ ├───entities # Core business entities
│ │ ├───interfaces # Interfaces for dependencies
│ │ ├───repositories # Repository interfaces
│ │ └───services # Service interfaces
│ │
│ ├───dto # Data transfer objects (request/response models)
│ └───infra # Infrastructure implementations
│ ├───databases # Database access implementations
│ ├───repositories # Implementations of repository interfaces
│ └───services # Implementations of service interfaces
├───pkg # Public library code
│ └───middlewares # Custom middleware implementations
├───test # Test-related files
└───vendor # Third-party dependencies (managed by `go mod`)
```## Update swagger document
```cmd
swag init -g cmd/api/main.go
```## Important command
```
go mod int
go get
go mod tidy
go mod vendor
swag init -g cmd/api/main.go
```
## Debug it locallyPlease install [delve](https://github.com/go-delve/delve/tree/master/Documentation/installation)
Click on debugger to run it.
## run it
```cmd
go run cmd/api/main.go
```
http://localhost:8080/swagger/index.html![image](https://github.com/user-attachments/assets/87469707-8407-4076-9893-f429f04c4e7b)