Handler Functions

Back To uAdmin Functions List

In this section, we will cover the following functions in-depth listed below:

uadmin.Handler

Back To Top

func Handler(f func(http.ResponseWriter, *http.Request)) func(http.ResponseWriter, *http.Request)

Handler is a function that takes an http handler function and returns an http handler function that has extra functionality including logging.

Used in the tutorial:

uadmin.StaticHandler

Back To Top

func StaticHandler(w http.ResponseWriter, r *http.Request)

StaticHandler is a function that serves static files.

Parameters:

w http.ResponseWriter: Assembles the HTTP server’s response; by writing to it, we send data to the HTTP client

r *http.Request Is a data structure that represents the client HTTP request

See Part 2: Static Handler for the example.

uadmin.UploadImageHandler

Back To Top

func UploadImageHandler(w http.ResponseWriter, r *http.Request, session *Session)

UploadImageHandler handles files sent from Tiny MCE’s photo uploader.

Parameters:

w http.ResponseWriter: Assembles the HTTP server’s response; by writing to it, we send data to the HTTP client

r *http.Request Is a data structure that represents the client HTTP request

session *Session Is an activity that a user with a unique IP address spends on a Web site during a specified period of time