func RunnerMiddleware() gin.HandlerFunc { return func(c *gin.Context) { if runnerutils.HasErrors() { runnerutils.RenderError(c.Writer) c.Abort(500) } } }
func runnerMiddleware(rw web.ResponseWriter, req *web.Request, next web.NextMiddlewareFunc) { if runnerutils.HasErrors() { runnerutils.RenderError(rw) return } next(rw, req) }
// Run the http server. Listening on os.GetEnv("PORT") or 3000 by default. func (m *Martini) Run() { port := os.Getenv("PORT") if len(port) == 0 { port = "3000" } if os.Getenv("DEV_RUNNER") == "1" { m.Use(func(res http.ResponseWriter, req *http.Request) { if runnerutils.HasErrors() { runnerutils.RenderError(res) } }) } m.logger.Println("listening on port " + port) m.logger.Fatalln(http.ListenAndServe(":"+port, m)) }
func runnerMiddleware(w http.ResponseWriter, r *http.Request) { if runnerutils.HasErrors() { runnerutils.RenderError(w) } }