Got the HanldeFunc() working, but not the file server.
[armadillo.git] / src / server.go
1 package server
2
3 import (
4 "fmt"
5 "http"
6 "io"
7 )
8
9 const kFrontEndFiles = "/Users/rsesek/Projects/armadillo/out/fe/"
10
11 func testHandler(connection *http.Conn, request *http.Request) {
12 fmt.Print("Got a request");
13 io.WriteString(connection, "Hello world")
14 }
15
16 func RunFrontEnd() {
17 mux := http.NewServeMux()
18 mux.Handle("/fe", http.FileServer(kFrontEndFiles, ""))
19 mux.HandleFunc("/test", testHandler)
20 // mux.Handle()
21 error := http.ListenAndServe(":8084", mux)
22 fmt.Printf("error %v", error)
23 }