feature: add optional context to handlers #19

Merged
xdrm-brackets merged 9 commits from feature/context into 0.3.0 2021-05-10 14:42:58 +00:00
1 changed files with 17 additions and 0 deletions
Showing only changes of commit f334d19ef4 - Show all commits

17
api/context.go Normal file
View File

@ -0,0 +1,17 @@
package api
import (
"net/http"
)
// Ctx contains additional information for handlers
//
// usually input/output arguments built by aicra are sufficient
// but the Ctx lets you manage your request from scratch if required
//
// If required, set api.Ctx as the first argument of your handler; if you
// don't need it, only use standard input arguments and it will be ignored
type Ctx struct {
w http.ResponseWriter
r *http.Request
}