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()
|
||||
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)
|
||||
}
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user