*macaron.Context
. This is the very core service for everything you do upon Macaron. It contains all the information you need for request, response, templating, data store, and inject or retrieve other services.Context.Next
is an optional feature that Middleware Handlers can call to yield the until after the other Handlers have been executed. This works really well for any operations that must happen after an HTTP request:SetCookie(<name>, <value>, <max age>, <path>, <domain>, <secure>, <http only>,<expires>)
.SetCookie("user", "unknwon", 999, "/", "localhost", true, true, time.Now())
.macaron.SetDefaultCookieSecret
, then use it by calling:ctx.SetParams
/ ctx.Params
, ctx.ParamsEscape
, ctx.ParamsInt
, ctx.ParamsInt64
, ctx.ParamsFloat64
ctx.Query
, ctx.QueryEscape
, ctx.QueryInt
, ctx.QueryInt64
, ctx.QueryFloat64
, ctx.QueryStrings
, ctx.QueryTrim
macaron.Logger
. It is responsible for your application routing log.macaron.Recovery
. It is responsible for recovering your application when panic happens.macaron.Static
. It is responsible for serving static resources of your application, it can be injected as many times as you want if you have multiple static directories.index.html
file./html/main.html
/html/
/css/main.css
macaron.Statics
to make your life easier.public
and views
as static directories.*log.Logger
. It is optional to use, but for convenience when you do not have a global level logger.http.ResponseWriter
. It is optional to use, normally, you should use *macaron.Context.Resp
.*http.Request
. It is optional to use, normally, you should use *macaron.Context.Req
.*http.Request
as an argument, you should use *macaron.Context.Req.Request
.