Remove HTTP/REST server, keep gRPC only
This commit is contained in:
@@ -6,18 +6,15 @@ import (
|
||||
"net"
|
||||
"os"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
"google.golang.org/grpc"
|
||||
"gopkg.in/yaml.v2"
|
||||
|
||||
// My modules
|
||||
"homelab.lan/music-agregator/internal"
|
||||
"homelab.lan/music-agregator/internal/config"
|
||||
"homelab.lan/music-agregator/internal/hello"
|
||||
"homelab.lan/music-agregator/internal/indexer"
|
||||
appRouter "homelab.lan/music-agregator/internal/router"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -33,21 +30,7 @@ func main() {
|
||||
}
|
||||
log.Info().Interface("config", cfg).Msg("Loaded config")
|
||||
|
||||
// start the grpc in another thread to not block the next http start
|
||||
go serveGrpc(*cfg)
|
||||
|
||||
serveHttp()
|
||||
}
|
||||
|
||||
func serveHttp() {
|
||||
router := gin.Default()
|
||||
appRouter.SetupRoutes(router)
|
||||
router.GET("/ping", func(c *gin.Context) {
|
||||
c.JSON(200, gin.H{
|
||||
"message": "pong",
|
||||
})
|
||||
})
|
||||
router.Run()
|
||||
serveGrpc(*cfg)
|
||||
}
|
||||
|
||||
func serveGrpc(config config.Config) {
|
||||
|
||||
Reference in New Issue
Block a user