CORS
This commit is contained in:
10
main.go
10
main.go
@ -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)))
|
||||
|
Reference in New Issue
Block a user