ytdl-web/web/serve.go

21 lines
347 B
Go
Raw Permalink Normal View History

2023-04-14 11:58:32 -04:00
package web
import (
"fmt"
2023-04-14 16:07:57 -04:00
2023-04-14 11:58:32 -04:00
"github.com/gofiber/fiber/v2"
"github.com/spf13/viper"
2023-04-14 11:58:32 -04:00
)
func Serve() error {
engine := ViewsEngine()
app := fiber.New(fiber.Config{Views: engine})
routes := &routes{}
2023-04-14 11:58:32 -04:00
routes.Register(app)
2023-04-14 11:58:32 -04:00
listenAddr := fmt.Sprintf("%s:%d", viper.GetString("listen"), viper.GetInt("port"))
return app.Listen(listenAddr)
2023-04-14 11:58:32 -04:00
}