Add CORS
This commit is contained in:
parent
df0f19eee5
commit
db6322d987
4 changed files with 54 additions and 50 deletions
|
@ -15,6 +15,7 @@ import (
|
|||
|
||||
rice "github.com/GeertJohan/go.rice"
|
||||
"github.com/fsnotify/fsnotify"
|
||||
"github.com/gorilla/handlers"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/renstrom/shortuuid"
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
@ -113,7 +114,7 @@ func (a *App) Run() error {
|
|||
}
|
||||
buildFeed(a)
|
||||
go startWatcher(a)
|
||||
return http.Serve(a.Listener, a.Router)
|
||||
return http.Serve(a.Listener, handlers.CORS()(a.Router))
|
||||
}
|
||||
|
||||
func (a *App) render(name string, w http.ResponseWriter, ctx interface{}) {
|
||||
|
|
File diff suppressed because one or more lines are too long
1
go.mod
1
go.mod
|
@ -12,6 +12,7 @@ require (
|
|||
github.com/dustin/go-humanize v1.0.0 // indirect
|
||||
github.com/fsnotify/fsnotify v1.4.7
|
||||
github.com/gorilla/feeds v1.1.1
|
||||
github.com/gorilla/handlers v1.4.2
|
||||
github.com/gorilla/mux v1.7.2
|
||||
github.com/koyachi/go-nude v0.0.1 // indirect
|
||||
github.com/mitchellh/mapstructure v1.2.2 // indirect
|
||||
|
|
2
go.sum
2
go.sum
|
@ -63,6 +63,8 @@ github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
|
|||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||
github.com/gorilla/feeds v1.1.1/go.mod h1:Nk0jZrvPFZX1OBe5NPiddPw7CfwF6Q9eqzaBbaightA=
|
||||
github.com/gorilla/handlers v1.4.2 h1:0QniY0USkHQ1RGCLfKxeNHK9bkDHGRYGNDFBCS+YARg=
|
||||
github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
|
||||
github.com/gorilla/mux v1.7.2 h1:zoNxOV7WjqXptQOVngLmcSQgXmgk4NMz1HibBchjl/I=
|
||||
github.com/gorilla/mux v1.7.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
||||
|
|
Loading…
Reference in a new issue