Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

url with trailingslash /user/100/ match Path: "/user/:id" shoud return 404 #8

Open
tablecell opened this issue Sep 3, 2021 · 0 comments

Comments

@tablecell
Copy link

package main

import (
	"github.com/zpatrick/fireball"
	"net/http"
)

func index(c *fireball.Context) (fireball.Response, error) {
	return fireball.NewResponse(200, []byte("Hello, World!"), nil), nil
}

func main() {
	indexRoute := &fireball.Route{
		Path: "/user/:id",
		Handlers: fireball.Handlers{
			"GET": index,
		},
	}

	routes := []*fireball.Route{indexRoute}
	app := fireball.NewApp(routes)
	http.ListenAndServe(":8000", app)
}

$ curl http://localhost:8000/user/100/
Hello, World!

package main
import (
    "fmt"
    "net/http"
)
func main() {
    http.HandleFunc("/user/100", func (w http.ResponseWriter, r *http.Request) {
        fmt.Fprintf(w, "Welcome to my website!")
    })
   http.ListenAndServe(":80", nil)
}

$ curl http://localhost:80/user/100/
404 page not found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant