Skip to content

Commit

Permalink
CORS
Browse files Browse the repository at this point in the history
  • Loading branch information
ericvolp12 committed Oct 10, 2024
1 parent a89c220 commit dc17352
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/jetstream/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/bluesky-social/jetstream/pkg/server"
"github.com/gorilla/websocket"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"github.com/prometheus/client_golang/prometheus/promhttp"

"github.com/urfave/cli/v2"
Expand Down Expand Up @@ -212,6 +213,10 @@ func Jetstream(cctx *cli.Context) error {
}

e := echo.New()
e.Use(middleware.CORSWithConfig(middleware.CORSConfig{
AllowOrigins: []string{"*"},
AllowMethods: []string{http.MethodGet, http.MethodHead, http.MethodOptions},
}))
e.GET("/", func(c echo.Context) error {
return c.String(http.StatusOK, "Welcome to Jetstream")
})
Expand Down

0 comments on commit dc17352

Please sign in to comment.