stubbed out go handlers
This commit is contained in:
parent
aff09ed2a1
commit
60fc35e6c8
13
handlers.go
Normal file
13
handlers.go
Normal 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"))
|
||||||
|
}
|
2
main.go
2
main.go
@ -16,6 +16,8 @@ func main() {
|
|||||||
flag.Parse()
|
flag.Parse()
|
||||||
http.Handle("/",
|
http.Handle("/",
|
||||||
http.FileServer(http.Dir(*static_files)))
|
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 {
|
if err := http.ListenAndServe(*addr, nil); err != nil {
|
||||||
log.Fatal("ListenAndServe:", err)
|
log.Fatal("ListenAndServe:", err)
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<title>{{ title }}</title>
|
<title>Mardson's Math Game</title>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<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>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<section id="content">
|
<section id="content">
|
||||||
@ -17,7 +17,7 @@
|
|||||||
<footer>
|
<footer>
|
||||||
score: <span id="score"></span>
|
score: <span id="score"></span>
|
||||||
</footer>
|
</footer>
|
||||||
<script src="{% static 'jquery-2.0.0.min.js' %}"></script>
|
<script src="/jquery-2.0.0.min.js"></script>
|
||||||
<script src="{% static "math.js" %}"></script>
|
<script src="/math.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user