Toggle navigation
Toggle navigation
This project
Loading...
Sign in
박시진
/
mamuri-bot
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
윤준석
2022-05-22 02:27:01 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
bcac1b533891e75c17247083ad9ca4bb399b4a5b
bcac1b53
1 parent
01624894
ADD: router and controller
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
0 deletions
bunjang/controller/controller.go
bunjang/main.go
bunjang/router/router.go
bunjang/controller/controller.go
0 → 100644
View file @
bcac1b5
package
controller
import
(
"bunjang/service"
"net/http"
"github.com/labstack/echo/v4"
)
func
Search
(
c
echo
.
Context
)
error
{
keyword
:=
c
.
Param
(
"keyword"
)
items
,
err
:=
service
.
GetItemByKeyword
(
keyword
)
if
err
!=
nil
{
return
err
}
return
c
.
JSON
(
http
.
StatusOK
,
items
)
}
bunjang/main.go
View file @
bcac1b5
package
main
import
(
"bunjang/router"
"github.com/labstack/echo/v4"
)
func
main
()
{
e
:=
echo
.
New
()
router
.
Init
(
e
)
e
.
Logger
.
Fatal
(
e
.
Start
(
":8080"
))
}
...
...
bunjang/router/router.go
0 → 100644
View file @
bcac1b5
package
router
import
(
"bunjang/controller"
"github.com/labstack/echo/v4"
)
const
(
API
=
"/api/v2"
APIBunJang
=
API
+
"/bunjang"
APIKeyword
=
APIBunJang
+
"/:keyword"
)
func
Init
(
e
*
echo
.
Echo
)
{
e
.
GET
(
APIKeyword
,
controller
.
Search
)
}
Please
register
or
login
to post a comment