package http import ( "net/http" "fmt" ) func NewServer(port string) (error) { server := http.NewServeMux() server_setup(server) if err := http.ListenAndServe(":" + port, server); err != nil { return err } return nil } func server_setup(server *http.ServeMux) { server.HandleFunc("/", test) } func test(w http.ResponseWriter, r *http.Request) { test_buf := make([]byte, 32) copy(test_buf, "test\ntest") if _, err := w.Write(test_buf); err != nil { fmt.Println(err) } }