Exemple #1
0
func helloRoute(ctx context.Context, w http.ResponseWriter, r *http.Request) {
	params, _ := router.FetchParams(ctx)
	utils.DumpJSON(
		w,
		map[string]interface{}{
			"status": "success",
			"msg":    "Hello, " + params.ByName("name") + "!",
		},
	)
}
Exemple #2
0
func slowRoute(ctx context.Context, w http.ResponseWriter, r *http.Request) {
	time.Sleep(10 * time.Second)
	utils.DumpJSON(w, `Im slow!`)
}