Пример #1
0
func createUser(c *echo.Context) error {
	u := new(user)
	if err := c.Bind(u); err != nil {
		return err
	}
	users[u.ID] = *u
	return c.JSON(http.StatusCreated, u)
}
Пример #2
0
func getUser(c *echo.Context) error {
	return c.JSON(http.StatusOK, users[c.P(0)])
}
Пример #3
0
func getUsers(c *echo.Context) error {
	return c.JSON(http.StatusOK, users)
}