Skip to content

Latest commit

 

History

History
32 lines (25 loc) · 619 Bytes

cors.md

File metadata and controls

32 lines (25 loc) · 619 Bytes

Enable CORS

  • Add package using go get github.com/bimalabs/middlewares

  • Add CORS middleware to dics/container.go

import (
	"github.com/bimalabs/framework/v4/middlewares"
	"github.com/bimalabs/middlewares/cors"
)

{
    Name:  "bima:middleware:cors",
    Scope: bima.Application,
    Build: func (options cors.Options) (middlewares.Middleware, error) {
        return cors.New(options), nil
    },
    Params: dingo.Params{
        "0": cors.Options{},
    },
},

You can refer to cors for more options

  • Add to configs/middlewares.yaml
middlewares:
    - cors