Skip to content

How to capture URL Parameters using * #1849

Answered by aldas
miketonks asked this question in Q&A
Discussion options

You must be logged in to vote

by using * as last part and getting that value with path := c.Param("*")

	e.GET("/api/:namespace/*", func(c echo.Context) error {
		namespace := c.Param("namespace")
		path := c.Param("*")
		
		fmt.Printf("Request: %s, %s\n", namespace, path)
		return c.JSON(http.StatusOK, map[string]string{"status": "ok"})
	})

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@miketonks
Comment options

Answer selected by aldas
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