import ( "github.com/labstack/echo" "net/http" ) func main() { e := echo.New() e.POST("/login", func(c echo.Context) error { username := c.FormValue("username") password := c.FormValue("password") // do something with the username and password return c.String(http.StatusOK, "Logged in successfully") }) e.Logger.Fatal(e.Start(":1323")) }
import ( "github.com/labstack/echo" "net/http" ) func main() { e := echo.New() e.GET("/:id", func(c echo.Context) error { id := c.Param("id") // do something with the id return c.String(http.StatusOK, "Received ID: "+id) }) e.Logger.Fatal(e.Start(":1323")) }In this example, we define a route that accepts a URL parameter called "id". We retrieve the value of this parameter using the "Param" method, and then do something with it, such as looking up a record in our database with that ID. Overall, the "Context" and "FormValue" subpackages of the "github.com/labstack/echo" package library provide a convenient way to work with HTTP requests and form data in Go.