From cf3f3c895a8b0f01ffa4356b8579168b6f6a93c9 Mon Sep 17 00:00:00 2001 From: nicaangelica <43918157+nicaangelica@users.noreply.github.com> Date: Fri, 4 Oct 2019 16:54:49 -0300 Subject: [PATCH] file go --- server.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 server.go diff --git a/server.go b/server.go new file mode 100644 index 0000000..f0468df --- /dev/null +++ b/server.go @@ -0,0 +1,28 @@ +package main + +import ( + "net/http" + + "github.com/labstack/echo" +) + +func main() { + e := echo.New() + e.GET("/", func(c echo.Context) error { + return c.String(http.StatusOK, "Hello, World!") + }) + e.Logger.Fatal(e.Start(":1323")) + + e.POST("/users", saveUser) + e.GET("/users/:id", getUser) + e.PUT("/users/:id", updateUser) + e.DELETE("/users/:id", deleteUser) +} + +// e.GET("/users/:id", getUser) +func getUser(c echo.Context) error { + // User ID from path `users/:id` + id := c.Param("id") + return c.String(http.StatusOK, id) +} +