mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-20 16:44:27 +01:00
refactor(concurrency): replaced manual WaitGroup management with new wg.Go() and removed redundant code.
This commit is contained in:
@@ -24,6 +24,7 @@ import (
|
||||
func NewHandler() *gin.Engine {
|
||||
gin.SetMode("release")
|
||||
r := gin.New()
|
||||
r.Use(NoCache())
|
||||
r.Use(ErrorHandler())
|
||||
r.Use(ErrorLoggingMiddleware())
|
||||
|
||||
@@ -113,6 +114,15 @@ func NewHandler() *gin.Engine {
|
||||
return r
|
||||
}
|
||||
|
||||
func NoCache() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
c.Header("Cache-Control", "no-cache, no-store, must-revalidate")
|
||||
c.Header("Pragma", "no-cache")
|
||||
c.Header("Expires", "0")
|
||||
c.Next()
|
||||
}
|
||||
}
|
||||
|
||||
func AuthMiddleware() gin.HandlerFunc {
|
||||
if !auth.IsEnabled() {
|
||||
return func(c *gin.Context) {
|
||||
|
||||
Reference in New Issue
Block a user