Example #1
0
// Hello is an example endpoint
func Hello(w http.ResponseWriter, r *http.Request) {
	ctx := &myContext{}
	flannel.Context(r, &ctx)
	flannel.LogInfo(r, "Hello was called by %s", ctx.Name)

	flannel.Write(w, http.StatusOK, fmt.Sprintf("Hello, %s. I've been called %d times.", ctx.Name, ctx.Counter))
}
Example #2
0
func Login(w http.ResponseWriter, r *http.Request) {
	login := &LoginForm{}
	flannel.DecodeForm(r, login)

	flannel.Write(w, http.StatusForbidden, fmt.Sprintf("User %s does not exist", login.Username))
}