2023-12-09 16:25:38 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-01-06 20:20:58 +00:00
|
|
|
"git.matterlinux.xyz/Matterlinux/website/lib"
|
2023-12-09 16:25:38 +00:00
|
|
|
"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")
|
2024-01-06 20:20:58 +00:00
|
|
|
app.Static("/assets", "./content/assets")
|
2023-12-09 16:25:38 +00:00
|
|
|
|
|
|
|
app.Get("/", routes.IndexRoute)
|
2024-01-06 20:20:58 +00:00
|
|
|
|
2023-12-09 16:25:38 +00:00
|
|
|
app.Get("/news", routes.NewsRoute)
|
|
|
|
app.Get("/news/:id", routes.PostRoute)
|
2024-01-06 20:20:58 +00:00
|
|
|
|
|
|
|
app.Get("/wiki", routes.WikiMainRoute)
|
|
|
|
app.Get("/wiki/:id", routes.WikiRoute)
|
|
|
|
|
2023-12-22 21:22:23 +00:00
|
|
|
app.Get("*", func(c *fiber.Ctx) error {
|
2024-01-06 20:20:58 +00:00
|
|
|
return lib.RenderError(c, 404)
|
2023-12-22 21:22:23 +00:00
|
|
|
})
|
2023-12-09 16:25:38 +00:00
|
|
|
|
|
|
|
log.Fatal(app.Listen(":9878"))
|
|
|
|
}
|