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 13:51:51 +02:00

26 lines
433 B
Go

package api
import (
"app/database"
"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) initialize() {
api.Database = database.Database{Location: "sqlite.db"}
api.Database.Initialize()
}
func (api *Api) Run() {
api.initialize()
api.Router = gin.Default()
api.defineRoutes()
api.Router.Run()
}