CORS stuff

This commit is contained in:
Caleb Denio 2022-04-25 12:31:02 -04:00
parent a4ecc652e3
commit 3342f3ed4a
No known key found for this signature in database
GPG key ID: D2E75BDDE8F717AD

View file

@ -38,6 +38,8 @@ func StartServer(config *Config) {
http.HandleFunc("/slack/leaderboard", HandleLeaderboardSlashCommand) http.HandleFunc("/slack/leaderboard", HandleLeaderboardSlashCommand)
http.HandleFunc("/slack/eventsCommand", HandleEventsSlashCommand) http.HandleFunc("/slack/eventsCommand", HandleEventsSlashCommand)
http.HandleFunc("/api/currentNumber", func(w http.ResponseWriter, r *http.Request) { http.HandleFunc("/api/currentNumber", func(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Access-Control-Allow-Origin", "*")
number, err := redisClient.Get("last_valid_number").Int() number, err := redisClient.Get("last_valid_number").Int()
if err != nil { if err != nil {
w.WriteHeader(500) w.WriteHeader(500)