-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
28 lines (22 loc) · 740 Bytes
/
main.go
File metadata and controls
28 lines (22 loc) · 740 Bytes
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
package main
import (
"net/http"
"github.com/Rahul-RB/go-jobqueue/routes"
"github.com/Rahul-RB/go-jobqueue/stream"
"github.com/gin-gonic/gin"
)
func main() {
router := gin.Default()
router.Use(stream.InjectStream(stream.NewStream()))
router.Static("/ui", "./ui")
router.LoadHTMLFiles("ui/index.html")
router.GET("/", func(c *gin.Context) {
c.HTML(http.StatusOK, "index.html", gin.H{})
})
v1Router := router.Group("/v1")
v1Router.POST("/job", routes.PostJob) // Create a job
v1Router.GET("/job/:id", routes.GetJob) // Get job metadata
v1Router.GET("/job/:id/output", routes.StreamOutput) // Get job metadata
// v1Router.DELETE("/job/:id") // Delete the job
router.Run(":3000")
}