summaryrefslogtreecommitdiffstats
path: root/api/server.go
diff options
context:
space:
mode:
authorElias Nahum <nahumhbl@gmail.com>2016-03-01 22:12:05 -0300
committerElias Nahum <nahumhbl@gmail.com>2016-03-01 23:27:20 -0300
commit3177f30829439604315563b32ace6f1305b43a66 (patch)
treefe6667cb646a35d5bf1a2b76b757922e02204570 /api/server.go
parent81f97ebc88be468f3cefecf8c850459d7eccc459 (diff)
downloadchat-3177f30829439604315563b32ace6f1305b43a66.tar.gz
chat-3177f30829439604315563b32ace6f1305b43a66.tar.bz2
chat-3177f30829439604315563b32ace6f1305b43a66.zip
Add Cors Handler
Diffstat (limited to 'api/server.go')
-rw-r--r--api/server.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/api/server.go b/api/server.go
index 070ed7a70..40d6ef3d2 100644
--- a/api/server.go
+++ b/api/server.go
@@ -21,6 +21,10 @@ type Server struct {
Router *mux.Router
}
+type CorsWrapper struct {
+ router *mux.Router
+}
+
var Srv *Server
func NewServer() {
@@ -65,7 +69,7 @@ func StartServer() {
throttled.DefaultDeniedHandler.ServeHTTP(w, r)
})
- handler = th.Throttle(Srv.Router)
+ handler = th.Throttle(&CorsWrapper{Srv.Router})
}
go func() {