Move handler to established URI. Add CORS wildcard.
This commit is contained in:
parent
a3d93e4a1b
commit
d83b2fc139
@ -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)
|
||||
|
||||
@ -4,46 +4,16 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="description" content="A layout example that shows off a responsive email layout.">
|
||||
|
||||
<title>Email – Layout Examples – Pure</title>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.4.2/pure.css">
|
||||
|
||||
|
||||
|
||||
|
||||
<link rel="stylesheet" href="/css/pure.css">
|
||||
<!--[if lte IE 8]>
|
||||
<link rel="stylesheet" href="css/layouts/email-old-ie.css">
|
||||
<link rel="stylesheet" href="/css/layouts/email-old-ie.css">
|
||||
<![endif]-->
|
||||
<!--[if gt IE 8]><!-->
|
||||
<link rel="stylesheet" href="css/layouts/email.css">
|
||||
<link rel="stylesheet" href="/css/layouts/email.css">
|
||||
<!--<![endif]-->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="layout" class="content pure-g">
|
||||
<div id="nav" class="pure-u">
|
||||
<a href="#" class="nav-menu-button">Menu</a>
|
||||
@ -52,6 +22,8 @@
|
||||
<button class="primary-button pure-button">Compose</button>
|
||||
|
||||
<div class="pure-menu pure-menu-open">
|
||||
<ul id="unread-list">
|
||||
</ul>
|
||||
<ul>
|
||||
<li><a href="#">Inbox <span class="email-count">(2)</span></a></li>
|
||||
<li><a href="#">Important</a></li>
|
||||
@ -220,8 +192,11 @@
|
||||
|
||||
// Your application code goes here...
|
||||
|
||||
});
|
||||
</script>
|
||||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
|
||||
<script src="/js/react.js"></script>
|
||||
<script src="/js/JSXTransformer.js"></script>
|
||||
<script src="/js/unread.js" type="text/jsx"></script>
|
||||
|
||||
<script>
|
||||
YUI().use('node-base', 'node-event-delegate', function (Y) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user