FEATURE: Add Cors
This commit is contained in:
parent
407deace22
commit
304f706dd6
2 changed files with 10 additions and 0 deletions
9
src/config/cors.go
Normal file
9
src/config/cors.go
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
package config
|
||||||
|
|
||||||
|
import "github.com/gofiber/fiber/v2/middleware/cors"
|
||||||
|
|
||||||
|
func SetupCors() {
|
||||||
|
App.Use(cors.New(cors.Config{
|
||||||
|
AllowOrigins: "http://localhost:5173",
|
||||||
|
}))
|
||||||
|
}
|
|
@ -18,6 +18,7 @@ func main() {
|
||||||
config.SetupValidator()
|
config.SetupValidator()
|
||||||
config.SetupMiddlewares()
|
config.SetupMiddlewares()
|
||||||
config.SetupFiber(viewFS)
|
config.SetupFiber(viewFS)
|
||||||
|
config.SetupCors()
|
||||||
|
|
||||||
if config.Env.Debug {
|
if config.Env.Debug {
|
||||||
config.App.Use(cors.New(cors.Config{
|
config.App.Use(cors.New(cors.Config{
|
||||||
|
|
Loading…
Reference in a new issue