func Hello(env mango.Env) (mango.Status, mango.Headers, mango.Body) { // to add a session attribute just add it to the map env.Session()["new_session_attribute"] = "Never Gonna Give You Up" // To remove a session attribute delete it from the map env.Session()["old_session_attribute"] = nil, false return 200, mango.Headers{}, mango.Body("Hello World!") }
func Hello(env mango.Env) (mango.Status, mango.Headers, mango.Body) { env.Logger().Println("Got a", env.Request().Method, "request for", env.Request().RawURL) response, err := http.Get("http://www.weddinggalleryweb.com/") if err != nil { env.Logger().Printf("%s", err) os.Exit(1) } defer response.Body.Close() contents, err := ioutil.ReadAll(response.Body) if err != nil { env.Logger().Printf("%s", err) os.Exit(1) } return 200, mango.Headers{}, mango.Body(contents) }
func Hello(env mango.Env) (mango.Status, mango.Headers, mango.Body) { env.Logger().Println("Got a", env.Request().Method, "request for", env.Request().RequestURI) return 200, mango.Headers{}, mango.Body("Hello Waold!") }
func Index(env mango.Env) (mango.Status, mango.Headers, mango.Body) { env.Logger().Println("Got a", env.Request().Method, "request") return 200, mango.Headers{}, mango.Body("Index here. untested :P") }