func main() {
r := gin.Default()
res, _ := http.Get("http://192.168.xxx//api/v2.0/projects/")
body, _ := ioutil.ReadAll(res.Body)
var projects string = string(body)
fmt.Println(string(body))
r.GET("/harbor/projects", func(ctx *gin.Context) {
ctx.JSON(http.StatusOK, gin.H{
"harbor-projects": projects,
})
})
r.Run(":8082")
}
go gin调用harbor API获取projects列表
2021/11/29 11:07:59