package main import ( "fmt" "net/http" "github.com/fragmenta/router" ) func main() { r := router.New() r.Get("/user/:id", func(c router.Context) error { id := c.Param("id") return c.Text(http.StatusOK, fmt.Sprintf("User ID: %s", id)) }) http.ListenAndServe(":3000", r) }
package main import ( "fmt" "net/http" "github.com/fragmenta/router" ) func main() { r := router.New() r.Get("/hello/:name", func(c router.Context) error { name := c.Param("name") return c.Text(http.StatusOK, fmt.Sprintf("Hello, %s!", name)) }) http.ListenAndServe(":3000", r) }In this example, we create a new router that defines a GET route for `/hello/:name`. The `name` parameter value is retrieved from the Context Param using the `Param` method and is then used to send a response back to the client. Overall, the github.com.fragmenta.router Context Param package library provides a convenient and simple way to handle URL parameter values in a Go web application.