Open
Description
test.go
package main
import (
"github.com/devfeel/dotweb"
)
func main() {
dotapp := dotweb.New()
dotapp.HttpServer.GET("/hello/:name", func(ctx dotweb.Context) error{
return ctx.WriteString("hello " + ctx.GetRouterName("name"))
})
dotapp.StartServer(80)
}
$ curl http://localhost/hello/xx/
Moved Permanently.
should return 404 like net/http
example.go
package main
import (
"fmt"
"net/http"
)
func main() {
http.HandleFunc("/hello/aa", func (w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Welcome to my website!")
})
http.ListenAndServe(":80", nil)
}
$ curl http://localhost/hello/xx/
404 page not found
Metadata
Metadata
Assignees
Labels
No labels