This repository has been archived on 2024-10-30. You can view files and clone it, but cannot push or open issues or pull requests.
swb6-it-sec/Lab01/app/api/api.go
2022-03-30 12:39:04 +02:00

23 lines
351 B
Go

package api
import (
"github.com/gin-gonic/gin"
)
func (api *Api) defineRoutes() {
api.Router.GET("/ping", func(c *gin.Context) {
c.JSON(200, gin.H{
"message": "pong",
})
})
}
func (api *Api) serve(address string) {
api.Router = gin.Default()
api.Router.Run(address)
}
func (api *Api) Run() {
api.defineRoutes()
api.serve(":8080")
}