A simple template for building web applications using Go and the Echo framework.
Go-Echo-Template
├── cmd // Command-line tools or applications
│ └── server // Server-related commands
│ └── main.go // Main entry point for the server
├── internal // Private application code, not intended for external use
│ ├── config // Configuration files and loading logic
│ │ └── config.go
│ ├── handler // HTTP request handlers
│ │ ├── common // Common handlers or utilities for handlers
│ │ │ ├── common.go
│ │ │ ├── proxy.go
│ │ │ └── systemInfo.go
│ │ ├── error.go // Error handling logic for handlers
│ │ └── handler.go // General handler definitions
│ ├── middleware // HTTP middleware functions
│ │ ├── cors.go // Cross-Origin Resource Sharing middleware
│ │ ├── elapsedTime.go // Middleware to measure request elapsed time
│ │ └── middleware.go // General middleware definitions
│ ├── model // Data models and business logic
│ │ └── base.go
│ └── utils // Utility functions and helpers
│ └── .gitkeep // Placeholder for an empty directory under Git
├── pkg // Public libraries and reusable packages
│ ├── logger // Logging utilities
│ │ └── logger.go
│ ├── request // HTTP request related functionalities
│ │ ├── request_test.go
│ │ └── request.go
│ └── system // System-related utilities (e.g., system info)
│ └── info.go
├── script // Automation scripts (e.g., build scripts)
│ ├── build-linux.ps1 // PowerShell script for building on Linux
│ └── build-windows.ps1 // PowerShell script for building on Windows
├── config.yaml // Application configuration file
├── Dockerfile // Docker build instructions
├── go.mod // Go module definition file
├── go.sum // Go module checksums
└── README.md // Project README file
# init project
go mod init chat-proxy
mkdir cmd pkg internal
go get github.com/labstack/echo/v4
# update all dependencies
go get -u ./...
# install dependencies
go mod tidy# run all tests
go test -count=1 -v -timeout 1000s ./...
# run specific test
go test -count=1 -v -run ^TestHTTPClient$ -timeout 1000s go-echo-template/pkg/request