Move handler to established URI. Add CORS wildcard.

This commit is contained in:
2014-03-02 22:37:29 -08:00
parent a3d93e4a1b
commit d83b2fc139
2 changed files with 11 additions and 35 deletions

View File

@@ -93,6 +93,7 @@ func newMailCounter() *mailCounter {
}
func (mc *mailCounter) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Access-Control-Allow-Origin", "*")
c := map[string]int{}
for k, v := range mc.counts {
if v != 0 {
@@ -269,7 +270,7 @@ func main() {
mc := newMailCounter()
go func() {
http.Handle("/", mc)
http.Handle("/unread", mc)
err := http.ListenAndServe(*addr, nil)
if err != nil {
log.Fatal(err)