Split run and logs

This commit is contained in:
nemunaire 2021-05-02 16:26:23 +02:00
commit 539cbd68a9
4 changed files with 56 additions and 13 deletions

10
app.go
View file

@ -41,7 +41,15 @@ func NewApp() App {
})
router.GET("/api/run", func(c *gin.Context) {
stream, err := docker.RunHello()
ctrid, err := docker.Run("hello-world")
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": err})
}
c.JSON(http.StatusOK, gin.H{"jobid": ctrid})
})
router.GET("/api/jobs/:jobid/logs", func(c *gin.Context) {
stream, err := docker.Logs(c.Param("jobid"))
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": err})
}