-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
35 lines (30 loc) · 1.09 KB
/
main.go
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
package main
import (
"log"
"os"
apimodule "github.com/bespinian/ackbar/internal/api"
"github.com/bespinian/ackbar/internal/backend"
"github.com/gin-gonic/gin"
)
func main() {
redisBackend := backend.RedisBackend{}
redisBackend.Initialize(os.Getenv("REDIS_CONNECTION_STRING"), "", 0)
api := apimodule.Api{Backend: &redisBackend}
router := gin.Default()
router.GET(apimodule.RootPath, api.GetInfo)
router.GET(apimodule.ContextsPath, api.GetContexts)
router.POST(apimodule.ContextsPath, api.PostContext)
router.GET(apimodule.ContextPath, api.GetContext)
router.DELETE(apimodule.ContextPath, api.DeleteContext)
router.GET(apimodule.PartitionsPath, api.GetPartitions)
router.POST(apimodule.PartitionsPath, api.PostPartition)
router.DELETE(apimodule.PartitionPath, api.DeletePartition)
router.POST(apimodule.WorkersPath, api.PostWorker)
router.GET(apimodule.WorkersPath, api.GetWorkers)
router.PUT(apimodule.WorkerPath, api.PutWorker)
router.DELETE(apimodule.WorkerPath, api.DeleteWorker)
err := router.Run("0.0.0.0:8080")
if err != nil {
log.Fatalf("Error running http router: %e", err)
}
}