From e3e3931d9e9dcffc7204b59b427288edca7084f0 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Wed, 18 Aug 2010 00:43:55 -0400 Subject: [PATCH] Got the HanldeFunc() working, but not the file server. --- src/server.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/server.go b/src/server.go index e7ebaf4..13566e8 100644 --- a/src/server.go +++ b/src/server.go @@ -2,9 +2,22 @@ package server import ( "fmt" + "http" + "io" ) -func RunFrontEnd() { - fmt.Print("hi") +const kFrontEndFiles = "/Users/rsesek/Projects/armadillo/out/fe/" + +func testHandler(connection *http.Conn, request *http.Request) { + fmt.Print("Got a request"); + io.WriteString(connection, "Hello world") } +func RunFrontEnd() { + mux := http.NewServeMux() + mux.Handle("/fe", http.FileServer(kFrontEndFiles, "")) + mux.HandleFunc("/test", testHandler) + // mux.Handle() + error := http.ListenAndServe(":8084", mux) + fmt.Printf("error %v", error) +} -- 2.22.5