summaryrefslogtreecommitdiff
path: root/context.go
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-11-26 09:54:49 +0800
committerEltrac <hi@guhub.cn>2025-11-26 09:54:49 +0800
commita555355d69a4fe9cd01d8bea86ce5b057cd1cd66 (patch)
treeab3a4efaf52f88f5c72eda9e961407e77a60ba2f /context.go
parent2f572636121a78c51b7188b7bd09965cb91c9dde (diff)
feat: implement minimal router
Diffstat (limited to 'context.go')
-rw-r--r--context.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/context.go b/context.go
index aa10769..fbb6a1e 100644
--- a/context.go
+++ b/context.go
@@ -1 +1,21 @@
package growel
+
+import (
+ "net/http"
+)
+
+type Context struct {
+ W http.ResponseWriter
+ R http.Request
+ Params map[string]string
+}
+
+type Handler func(c *Context)
+
+func (h Handler) ServeHTTP(w http.ResponseWriter, r http.Request) {
+ h(&Context{
+ W: w,
+ R: r,
+ Params: make(map[string]string),
+ })
+}