Go workspace (go.work) with 5 microservices + shared library: - gateway (8080), auth-service (8081), purchaser-service (8082) - textile-service (8083), washing-service (8084) - shared: proto definitions, common packages Infrastructure: docker-compose for local dev, K8s manifests for K3s cluster deployment (mysql/redis/etcd + traefik ingress). Frontend (iloom-flatten) added as git submodule. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
25 lines
426 B
Go
25 lines
426 B
Go
package middleware
|
|
|
|
import (
|
|
"log"
|
|
"net/http"
|
|
"runtime/debug"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func Recovery() gin.HandlerFunc {
|
|
return func(c *gin.Context) {
|
|
defer func() {
|
|
if r := recover(); r != nil {
|
|
log.Printf("[PANIC] %v\n%s", r, debug.Stack())
|
|
c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{
|
|
"code": 50000,
|
|
"message": "internal server error",
|
|
})
|
|
}
|
|
}()
|
|
c.Next()
|
|
}
|
|
}
|