This repository was archived by the owner on Oct 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
53 lines (43 loc) · 2 KB
/
main.go
File metadata and controls
53 lines (43 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* ********************************************************************************************************** */
/* */
/* ::::::::: :::::::: :::::::: ::: ::: :::::::::: */
/* main.go :+: :+: :+: :+: :+: :+: :+: :+: :+: */
/* +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ */
/* By: ES-Yukun <yukun@doche.io> +#+ +:+ +#+ +:+ +#+ +#++:++#++ +#++:++# */
/* +#+ +#+ +#+ +#+ +#+ +#+ +#+ +#+ */
/* Created: 2023/08/09 23:48:06 by ES-Yukun #+# #+# #+# #+# #+# #+# #+# #+# #+# */
/* Updated: 2023/08/09 23:48:07 by ES-Yukun ######### ######## ######## ### ### ##########.io. */
/* */
/* ********************************************************************************************************** */
package main
import (
"log"
"github.com/gin-gonic/gin"
"github.com/docheio/container-api/handler"
"github.com/docheio/container-api/utils"
)
func main() {
flags := utils.Flags{}
flags.Init()
if *flags.Debug {
gin.SetMode(gin.DebugMode)
} else {
gin.SetMode(gin.ReleaseMode)
}
handler := handler.Handler{}
handler.Init()
handler.Namespace = *flags.Namespace
handler.Uniquekey = *flags.Uniquekey
handler.Image = *flags.Image
router := gin.Default()
routerV1 := router.Group("/v1")
routerV1.POST("/", handler.Create)
routerV1.GET("/", handler.GetAll)
routerV1.GET("/:id", handler.GetOne)
routerV1.PUT("/:id", handler.Update)
routerV1.DELETE("/:id", handler.Delete)
log.Println("Server Start")
if err := router.Run(*flags.Address); err != nil {
log.Fatalln(err)
}
}