Пример #1
0
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)
}
Пример #2
0
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!")
}
Пример #3
0
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")
}