mirror of
https://github.com/Sosokker/openweathermap-dashboard.git
synced 2025-12-18 13:44:04 +01:00
feat: add cors header
This commit is contained in:
parent
3f62e9c5d8
commit
5cb05709dd
@ -131,10 +131,16 @@ func readCoordData(filepath string, coordCh chan<- Coordinate) {
|
||||
close(coordCh)
|
||||
}
|
||||
|
||||
// https://www.stackhawk.com/blog/golang-cors-guide-what-it-is-and-how-to-enable-it/
|
||||
func enableCors(w *http.ResponseWriter) {
|
||||
(*w).Header().Set("Access-Control-Allow-Origin", "*")
|
||||
}
|
||||
|
||||
// lat, lon, rain+place
|
||||
// state-id, rainfall (scale 100)
|
||||
|
||||
func rawDataHandler(w http.ResponseWriter, r *http.Request) {
|
||||
enableCors(&w)
|
||||
apiKey := loadEnv()
|
||||
|
||||
coordCh := make(chan Coordinate)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user