src/api/routes.go (view raw)
1package api
2
3import (
4 "log"
5 "net/http"
6)
7
8const address = ":3000"
9
10func ListenAndServe() {
11 http.Handle("GET /", http.FileServer(http.Dir("static")))
12
13 http.HandleFunc("GET /api/bookmakers", getBookmakers)
14 http.HandleFunc("POST /api/bookmakers", postBookmakers)
15
16 http.HandleFunc("GET /api/accounts", getAccounts)
17 http.HandleFunc("POST /api/accounts", postAccounts)
18
19 http.HandleFunc("GET /api/records", getRecords)
20 http.HandleFunc("POST /api/records", postRecords)
21
22 log.Println("Serving at " + address + "...")
23 log.Fatal(http.ListenAndServe(address, nil))
24}