21 lines
347 B
Go
21 lines
347 B
Go
package web
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/gofiber/fiber/v2"
|
|
"github.com/spf13/viper"
|
|
)
|
|
|
|
func Serve() error {
|
|
engine := ViewsEngine()
|
|
app := fiber.New(fiber.Config{Views: engine})
|
|
routes := &routes{}
|
|
|
|
routes.Register(app)
|
|
|
|
listenAddr := fmt.Sprintf("%s:%d", viper.GetString("listen"), viper.GetInt("port"))
|
|
|
|
return app.Listen(listenAddr)
|
|
}
|