Esempio n. 1
0
func (h *IndexHandler) Get(request *tango.HttpRequest) *tango.HttpResponse {
	debug := fmt.Sprintf("Debug: <b>%v</b>", tango.Debug)
	gopath := fmt.Sprintf("Go Path: <b>%s</b>", tango.Settings.String("gopath", "why this not set?"))
	bad := fmt.Sprintf("Not Set: <b>%s</b>", tango.Settings.String("not_set", "but we supplied a default!"))

	output := fmt.Sprintf("%s<br />%s<br />%s", debug, gopath, bad)

	return tango.NewHttpResponse(output)
}
Esempio n. 2
0
func (h *IndexHandler) Get(request *tango.HttpRequest) *tango.HttpResponse {
	debug := fmt.Sprintf("Debug: <b>%v</b>", tango.Debug)
	number := fmt.Sprintf("Some Number: <b>%d</b>", tango.Settings.Int("some_number"))
	bad := fmt.Sprintf("Not Set: <b>%s</b>", tango.Settings.String("not_set", "but we supplied a default!"))

	output := fmt.Sprintf("%s<br />%s<br />%s", debug, number, bad)

	return tango.NewHttpResponse(output)
}
Esempio n. 3
0
func (h *IndexHandler) Get(request *tango.HttpRequest) *tango.HttpResponse {
	inline := fmt.Sprintf("Inline: <b>%s</b>", tango.Settings.String("inline"))
	json := fmt.Sprintf("A json val: <b>%s</b>", tango.Settings.String("project_name"))
	env := fmt.Sprintf("DB Pass from Env: <b>%s</b>", tango.Settings.String("db_pass"))
	bad := fmt.Sprintf("Not Set: <b>%s</b>", tango.Settings.String("not_set", "but we supplied a default!"))

	output := fmt.Sprintf("%s<br />%s<br />%s<br />%s", inline, json, env, bad)

	return tango.NewHttpResponse(output)
}
Esempio n. 4
0
func (h *IndexHandler) Get(request *tango.HttpRequest) *tango.HttpResponse {
	project := fmt.Sprintf("Project Name: <b>%s</b>", tango.Settings.String("project_name"))
	number := fmt.Sprintf("Some Number: <b>%d</b>", tango.Settings.Int("some_number"))
	other := fmt.Sprintf("Some Other Number: <b>%f</b>", tango.Settings.Float("some_other_number"))
	ready := fmt.Sprintf("Is Production Ready: <b>%v</b>", tango.Settings.Bool("is_production_ready"))
	bad := fmt.Sprintf("Not Set: <b>%s</b>", tango.Settings.String("not_set", "but we supplied a default!"))

	output := fmt.Sprintf("%s<br />%s<br />%s<br />%s<br />%s", project, number, other, ready, bad)

	return tango.NewHttpResponse(output)
}
Esempio n. 5
0
func (h *IndexHandler) Get(request *tango.HttpRequest) *tango.HttpResponse {
	query := "SELECT clock_timestamp();"

	stmt, err := Db.Prepare(query)
	if err != nil {
		tango.LogError.Panicf("DB 1 error:", err)
	}
	defer stmt.Close()

	var datetime time.Time
	err = stmt.QueryRow().Scan(&datetime)
	if err != nil {
		tango.LogError.Panicf("DB 2 error:", err)
	}

	return tango.NewHttpResponse(fmt.Sprintf("Postgres clock_timestamp is: %s", datetime))
}
Esempio n. 6
0
func (h *NotFoundHandler) Get(request *tango.HttpRequest) *tango.HttpResponse {
	return tango.NewHttpResponse("Sorry... this page does not not exist. Don't forget to set this handler as <strong>404</strong>!!", 404)
}
Esempio n. 7
0
func (h *IndexHandler) Get(request *tango.HttpRequest) *tango.HttpResponse {
	return tango.NewHttpResponse("Hello! Now visit a non existent <a href=\"/404/\">page</a>.")
}
Esempio n. 8
0
func (h *IndexHandler) Get(request *tango.HttpRequest) *tango.HttpResponse {
	return tango.NewHttpResponse("Hello, world.")
}
Esempio n. 9
0
func (h *IndexHandler) Get(request *tango.HttpRequest) *tango.HttpResponse {
	return tango.NewHttpResponse("View the headers of this page... you will see 'X-Runtime' in the response headers.")
}