stubbed out go handlers

This commit is contained in:
Stephen McQuay 2013-05-08 22:57:52 -07:00
parent aff09ed2a1
commit 60fc35e6c8
3 changed files with 19 additions and 4 deletions

13
handlers.go Normal file
View File

@ -0,0 +1,13 @@
package main
import (
"net/http"
)
func attempt(w http.ResponseWriter, req *http.Request) {
w.Write([]byte("hello"))
}
func problem(w http.ResponseWriter, req *http.Request) {
w.Write([]byte("hello"))
}

View File

@ -16,6 +16,8 @@ func main() {
flag.Parse()
http.Handle("/",
http.FileServer(http.Dir(*static_files)))
http.HandleFunc("/api/v0/attempt/", attempt)
http.HandleFunc("/api/v0/problem/", problem)
if err := http.ListenAndServe(*addr, nil); err != nil {
log.Fatal("ListenAndServe:", err)
}

View File

@ -1,9 +1,9 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>{{ title }}</title>
<title>Mardson's Math Game</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="{% static "math.css" %}" rel="stylesheet" media="screen">
<link href="/math.css" rel="stylesheet" media="screen">
</head>
<body>
<section id="content">
@ -17,7 +17,7 @@
<footer>
score: <span id="score"></span>
</footer>
<script src="{% static 'jquery-2.0.0.min.js' %}"></script>
<script src="{% static "math.js" %}"></script>
<script src="/jquery-2.0.0.min.js"></script>
<script src="/math.js"></script>
</body>
</html>