website/main.go

33 lines
735 B
Go

package main
import (
"git.matterlinux.xyz/Matterlinux/website/lib"
"git.matterlinux.xyz/Matterlinux/website/routes"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/log"
"github.com/gofiber/template/html/v2"
)
func main(){
engine := html.New("./templates", ".html")
app := fiber.New(fiber.Config{
Views: engine,
})
app.Static("/", "./public")
app.Static("/assets", "./content/assets")
app.Get("/", routes.IndexRoute)
app.Get("/news", routes.NewsRoute)
app.Get("/news/:id", routes.PostRoute)
app.Get("/wiki", routes.WikiMainRoute)
app.Get("/wiki/:id", routes.WikiRoute)
app.Get("*", func(c *fiber.Ctx) error {
return lib.RenderError(c, 404)
})
log.Fatal(app.Listen(":9878"))
}