Fix html rendering
This commit is contained in:
parent
be890e2e75
commit
1629523d84
7 changed files with 56 additions and 4 deletions
|
@ -29,11 +29,26 @@ func InitRouter() *echo.Echo {
|
|||
e.Pre(middleware.RemoveTrailingSlash())
|
||||
|
||||
e.Validator = &CustomValidator{Validator: newValidator()}
|
||||
e.Renderer = initTemplates()
|
||||
|
||||
return e
|
||||
}
|
||||
|
||||
func SetupRoutes(e *echo.Echo, ctrl *controller.Controller, env *env.Config) {
|
||||
favicon := e.Group("/favicon", longCacheLifetime)
|
||||
favicon.Static("/", "web/favicon")
|
||||
fonts := e.Group("/fonts", longCacheLifetime)
|
||||
fonts.Static("/", "web/fonts")
|
||||
img := e.Group("/img", longCacheLifetime)
|
||||
img.Static("/", "web/img")
|
||||
|
||||
e.Static("/css", "web/css")
|
||||
e.Static("/js", "web/js")
|
||||
|
||||
e.GET("/", func(c echo.Context) error {
|
||||
return c.Render(http.StatusOK, "index.html", nil)
|
||||
})
|
||||
|
||||
api := e.Group("/api")
|
||||
{
|
||||
tableGroup := api.Group("/tables")
|
||||
|
@ -79,6 +94,13 @@ func SetupRoutes(e *echo.Echo, ctrl *controller.Controller, env *env.Config) {
|
|||
})
|
||||
}
|
||||
|
||||
e.GET("/robots.txt", func(ctx echo.Context) error {
|
||||
return ctx.String(http.StatusOK, "User-agent: *\nDisallow: /")
|
||||
})
|
||||
e.RouteNotFound("*", func(ctx echo.Context) error {
|
||||
return ctx.Redirect(http.StatusTemporaryRedirect, "/")
|
||||
})
|
||||
|
||||
if env.SwaggerHost != "" {
|
||||
docs.SwaggerInfo.Title = "Café Plätschwiesle"
|
||||
docs.SwaggerInfo.Description = "This is the backend of Café Plätschwiesle"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue