add: 模仿gin框架

This commit is contained in:
2022-02-13 11:46:56 +08:00
parent 6633420cf6
commit ea348b07a6
4 changed files with 71 additions and 4 deletions

View File

@@ -11,7 +11,7 @@ type Engine struct {
// 实现Handler的ServerHTTP方法
func (e *Engine) ServeHTTP(w http.ResponseWriter, r *http.Request) {
switch r.RequestURI {
switch r.URL.Path {
case "/":
fmt.Fprint(w, "hello handler-basic")
case "/web":