윤준석

ADD: controller about search items by keyword

1 +package controller
2 +
3 +import (
4 + "joongna/service"
5 + "net/http"
6 +
7 + "github.com/labstack/echo/v4"
8 +)
9 +
10 +func Search(c echo.Context) error {
11 + keyword := c.Param("keyword")
12 + items, err := service.GetItemByKeyword(keyword)
13 + if err != nil {
14 + return err
15 + }
16 + return c.JSON(http.StatusOK, items)
17 +}
1 package router 1 package router
2 2
3 -import "github.com/labstack/echo/v4" 3 +import (
4 + "joongna/controller"
5 +
6 + "github.com/labstack/echo/v4"
7 +)
4 8
5 const ( 9 const (
6 API = "/api/v2" 10 API = "/api/v2"
......