go-ozzo / ozzo-routing

An extremely fast Go (golang) HTTP router that supports regular expression route matching. Comes with full support for building RESTful APIs.
MIT License
453 stars 51 forks source link

Is there a way to get the name of current route? #40

Open puper opened 7 years ago

puper commented 7 years ago

Im want to do some permission check in middleware.

betelgeuse-7 commented 2 years ago

I don't use this package, but by looking at the source code, I can say you can get the request path using this:

func yourController(c *routing.Context) {
     path := c.Request.URL.Path
     c.Write(fmt.Sprintf("you hit %s", path))
}