-
Notifications
You must be signed in to change notification settings - Fork 0
/
view.go
34 lines (32 loc) · 954 Bytes
/
view.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
package helpers
import (
"github.com/gofiber/fiber/v2"
"github.com/sujit-baniya/fiberRoute"
contractRoute "github.com/sujit-baniya/framework/contracts/route"
"github.com/sujit-baniya/framework/facades"
"github.com/sujit-baniya/framework/http"
"github.com/sujit-baniya/framework/route"
"github.com/sujit-baniya/framework/view"
"github.com/sujit-baniya/ginRoute"
)
func GetRouter() contractRoute.Engine {
router := facades.Config.GetString("app.router")
template := facades.Config.GetString("view.template")
extension := facades.Config.GetString("view.extension")
//Default Chi (standard net/http) is used: https://github.com/sujit-baniya/chi
viewEngine := view.New(template, extension)
switch router {
case "fiber":
return fiberRoute.New(fiber.Config{
Views: viewEngine,
})
case "gin":
return ginRoute.New(ginRoute.Config{
View: viewEngine,
})
default:
return route.NewChi(http.ChiConfig{
View: viewEngine,
})
}
}