mirror of
https://github.com/balzack/databag.git
synced 2025-02-12 03:29:16 +00:00
enabling cors
This commit is contained in:
parent
7e8bf0a4b8
commit
1ea1b73fc0
@ -7,6 +7,8 @@ import (
|
||||
|
||||
func GetAccountListing(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
EnableCors(&w);
|
||||
|
||||
var accounts []store.Account
|
||||
if err := store.DB.Preload("AccountDetail").Where("searchable = ? AND disabled = ?", true, false).Find(&accounts).Error; err != nil {
|
||||
ErrResponse(w, http.StatusInternalServerError, err)
|
||||
|
@ -59,3 +59,7 @@ func ParseRequest(r *http.Request, w http.ResponseWriter, obj interface{}) error
|
||||
return dec.Decode(&obj)
|
||||
}
|
||||
|
||||
func EnableCors(w *http.ResponseWriter) {
|
||||
(*w).Header().Set("Access-Control-Allow-Origin", "*")
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user