Esempio n. 1
0
func startWeb() {
	if p := os.Getenv("PORT"); p != "" {
		port = p
	}

	n := negroni.New()

	n.Use(negroni.HandlerFunc(recovery))
	n.Use(negroni.HandlerFunc(development))
	n.Use(nlogger.New("ns=kernel", nil))

	n.UseHandler(controllers.NewRouter())

	n.Run(fmt.Sprintf(":%s", port))
}
Esempio n. 2
0
func main() {
	if p := os.Getenv("PORT"); p != "" {
		port = p
	}

	router := mux.NewRouter()

	router.HandleFunc("/", index).Methods("GET")
	router.HandleFunc("/check", check).Methods("GET")

	n := negroni.New(
		negroni.NewRecovery(),
		nlogger.New("ns=dashboard", nil),
		negroni.NewStatic(http.Dir("public")),
	)

	n.UseHandler(router)
	n.Run(fmt.Sprintf(":%s", port))
}