Skip to content

Commit

Permalink
fix: cors
Browse files Browse the repository at this point in the history
  • Loading branch information
dexturr committed Jan 24, 2023
1 parent 70ae59c commit 9609613
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ func main() {
log.Printf("starting http API on port: %v", port)

router := httprouter.New()

router.GET("/user/:address", state.GetUserByAddress)
router.GET("/tranches/stats", state.GetTranchesStats)

Expand All @@ -476,6 +477,8 @@ func main() {
}

func writeOK(w http.ResponseWriter, payload interface{}) {
w.Header().Set("Access-Control-Allow-Methods", w.Header().Get("Allow"))
w.Header().Set("Access-Control-Allow-Origin", "*")
w.Header().Set("Content-Type", "application/json")
buf, err := json.Marshal(payload)
if err != nil {
Expand Down

0 comments on commit 9609613

Please sign in to comment.