first commit

way too late.
This commit is contained in:
didier amyot committed 2015-02-06 22:03:05 -08:00
commit d4f7dc57fc
53 files changed
+3518

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
package main
import (
"fmt"
"log"
"net/http"
"strconv"
"github.com/didiercrunch/doormanserver/shared"
"github.com/gorilla/mux"
)
func createMuxRouter() http.Handler {
r := mux.NewRouter()
serveApi(r.PathPrefix("/api").Subrouter())
serveStatic(r.PathPrefix("/").Subrouter())
return r
}
func GetAddressToServe() string {
params := shared.GetParams()
return params.Host + ":" + strconv.Itoa(params.Port)
}
func main() {
r := createMuxRouter()
http.Handle("/", r)
address := GetAddressToServe()
fmt.Println("server running at", address)
if err := http.ListenAndServe(address, createMuxRouter()); err != nil {
log.Fatal(err)
}
}