]>
src.bluestatic.org Git - armadillo.git/blob - src/server.go
11 const kFrontEndFiles
= "/Users/rsesek/Projects/armadillo/out/fe/"
13 func testHandler(connection
*http
.Conn
, request
*http
.Request
) {
14 fmt
.Print("Got a request");
15 io
.WriteString(connection
, "Hello world")
18 func indexHandler(connection
*http
.Conn
, request
*http
.Request
) {
19 fd
, err
:= os
.Open(path
.Join(kFrontEndFiles
, "index.html"), os
.O_RDONLY
, 0)
21 fmt
.Print("Error opening file ", err
.String(), "\n")
24 io
.Copy(connection
, fd
)
28 mux
:= http
.NewServeMux()
29 mux
.HandleFunc("/", indexHandler
)
30 mux
.Handle("/fe/", http
.FileServer(kFrontEndFiles
, "/fe/"))
31 mux
.HandleFunc("/test", testHandler
)
33 error
:= http
.ListenAndServe(":8084", mux
)
34 fmt
.Printf("error %v", error
)