This commit is contained in:
2025-03-24 01:15:32 -06:00
parent 0b85919395
commit 4547bf9f6e
2 changed files with 18 additions and 0 deletions

10
main.go
View File

@ -43,6 +43,16 @@ func main() {
}))
e.Use(middleware.RateLimiter(middleware.NewRateLimiterMemoryStore(50)))
// Add CORS middleware
e.Use(middleware.CORSWithConfig(middleware.CORSConfig{
AllowOrigins: []string{"https://atri.dad", "http://localhost:3000"},
AllowMethods: []string{http.MethodGet, http.MethodPost, http.MethodPut, http.MethodDelete},
AllowHeaders: []string{echo.HeaderOrigin, echo.HeaderContentType, echo.HeaderAccept},
ExposeHeaders: []string{echo.HeaderContentType},
AllowCredentials: true,
MaxAge: 86400,
}))
// Static server
fs := http.FS(PublicFS)
e.GET("/public/*", echo.WrapHandler(http.FileServer(fs)))