Skip to content
Discussion options

You must be logged in to vote

yes, it is identended behavior in v5 that when you add a route the result is not a mutable (pointer).

In v5 if you want to create named route you need to do:

	handler := func(c *echo.Context) error {
		return c.String(http.StatusOK, "Hello, World!")
	}
	_, _ := e.AddRoute(echo.Route{
		Method:      http.MethodGet,
		Path:        "/test",
		Name:        "my-route",
		Handler:     handler,
		Middlewares: nil,
	})

If you want to rename route - it has to be reregistered. and possibily configure router to allow overwriting

	e := echo.NewWithConfig(echo.Config{
		Router: echo.NewRouter(echo.RouterConfig{
			AllowOverwritingRoute: false,
		}),
	})

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by wrongfuldev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants