add pathvalue and url query
This commit is contained in:
parent
89afb56836
commit
554fb45e33
8
ron.go
8
ron.go
@ -239,6 +239,14 @@ func (e *Engine) Static(path, dir string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *CTX) Path(key string) string {
|
||||||
|
return c.R.PathValue(key)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *CTX) Query(key string) string {
|
||||||
|
return c.R.URL.Query().Get(key)
|
||||||
|
}
|
||||||
|
|
||||||
func (c *CTX) JSON(code int, data any) {
|
func (c *CTX) JSON(code int, data any) {
|
||||||
c.W.Header().Set("Content-Type", "application/json")
|
c.W.Header().Set("Content-Type", "application/json")
|
||||||
encoder := json.NewEncoder(c.W)
|
encoder := json.NewEncoder(c.W)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user