Skip to content

Commit

Permalink
Added CORS compatibility to API.
Browse files Browse the repository at this point in the history
Also fixed spelling mistake in API info endpoint.
  • Loading branch information
AustinDizzy committed Aug 30, 2015
1 parent 3a76df4 commit fffe8d7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion routes.go
Expand Up @@ -41,8 +41,9 @@ func AuthHandler(w http.ResponseWriter, r *http.Request) {
}

func ApiRoot(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Access-Control-Allow-Origin", "*")
data := map[string]interface{}{
"message": "PRT Status endpoint. Read more here: https://github.com/AustinDizzy/prtstatus-su",
"message": "PRT Status endpoint. Read more here: https://github.com/AustinDizzy/prtstatus-go",
"users": userCount(),
"success": true,
}
Expand All @@ -53,6 +54,7 @@ func ApiRoot(w http.ResponseWriter, r *http.Request) {
func ApiHandler(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
w.Header().Set("Content-Type", "application/json")
w.Header().Set("Access-Control-Allow-Origin", "*")
data := map[string]interface{}{}

if config.Debug {
Expand Down

0 comments on commit fffe8d7

Please sign in to comment.