package main import ( "fmt" "net/http" "net/http/cgi" "os" "faculty_media_report/pages" ) func handler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/html; charset=utf-8") fmt.Fprint(w, pages.MainFormPage) } func main() { if os.Getenv("GATEWAY_INTERFACE") != "" { cgi.Serve(http.HandlerFunc(handler)) } else { http.HandleFunc("/", handler) fmt.Fprintln(os.Stderr, "Running in standalone mode on :9001") http.ListenAndServe(":9001", nil) } }