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) {
|
func (mc *mailCounter) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
|
w.Header().Set("Access-Control-Allow-Origin", "*")
|
||||||
c := map[string]int{}
|
c := map[string]int{}
|
||||||
for k, v := range mc.counts {
|
for k, v := range mc.counts {
|
||||||
if v != 0 {
|
if v != 0 {
|
||||||
@ -269,7 +270,7 @@ func main() {
|
|||||||
|
|
||||||
mc := newMailCounter()
|
mc := newMailCounter()
|
||||||
go func() {
|
go func() {
|
||||||
http.Handle("/", mc)
|
http.Handle("/unread", mc)
|
||||||
err := http.ListenAndServe(*addr, nil)
|
err := http.ListenAndServe(*addr, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
|||||||
@ -4,46 +4,16 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<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.">
|
<meta name="description" content="A layout example that shows off a responsive email layout.">
|
||||||
|
|
||||||
<title>Email – Layout Examples – Pure</title>
|
<title>Email – Layout Examples – Pure</title>
|
||||||
|
<link rel="stylesheet" href="/css/pure.css">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<link rel="stylesheet" href="http://yui.yahooapis.com/pure/0.4.2/pure.css">
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!--[if lte IE 8]>
|
<!--[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]-->
|
<![endif]-->
|
||||||
<!--[if gt IE 8]><!-->
|
<!--[if gt IE 8]><!-->
|
||||||
<link rel="stylesheet" href="css/layouts/email.css">
|
<link rel="stylesheet" href="/css/layouts/email.css">
|
||||||
<!--<![endif]-->
|
<!--<![endif]-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div id="layout" class="content pure-g">
|
<div id="layout" class="content pure-g">
|
||||||
<div id="nav" class="pure-u">
|
<div id="nav" class="pure-u">
|
||||||
<a href="#" class="nav-menu-button">Menu</a>
|
<a href="#" class="nav-menu-button">Menu</a>
|
||||||
@ -52,6 +22,8 @@
|
|||||||
<button class="primary-button pure-button">Compose</button>
|
<button class="primary-button pure-button">Compose</button>
|
||||||
|
|
||||||
<div class="pure-menu pure-menu-open">
|
<div class="pure-menu pure-menu-open">
|
||||||
|
<ul id="unread-list">
|
||||||
|
</ul>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#">Inbox <span class="email-count">(2)</span></a></li>
|
<li><a href="#">Inbox <span class="email-count">(2)</span></a></li>
|
||||||
<li><a href="#">Important</a></li>
|
<li><a href="#">Important</a></li>
|
||||||
@ -220,8 +192,11 @@
|
|||||||
|
|
||||||
// Your application code goes here...
|
// Your application code goes here...
|
||||||
|
|
||||||
});
|
|
||||||
</script>
|
</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>
|
<script>
|
||||||
YUI().use('node-base', 'node-event-delegate', function (Y) {
|
YUI().use('node-base', 'node-event-delegate', function (Y) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user