| 123456789101112131415161718192021222324 |
- package main
- import (
- "runtime"
- "log"
- "net/http"
- "pinguin/board"
- )
- func main() {
- runtime.GOMAXPROCS(1)
- http.HandleFunc("/api/board", boardHandler)
- http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
- w.Write([]byte("Go battlecamp!"))
- })
- log.Fatal(http.ListenAndServe(":8080", nil))
- }
- func boardHandler(w http.ResponseWriter, req *http.Request) {
- b := board.New(56, 35)
- w.Header().Set("Content-Type", "text/plain;charset=utf-8")
- b.WriteJSON(w)
- }
|