/* * website | MatterLinux website * MatterLinux 2023-2024 (https://matterlinux.xyz) * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ package main import ( "git.matterlinux.xyz/Matter/website/lib" "git.matterlinux.xyz/Matter/website/log" "git.matterlinux.xyz/Matter/website/routes" "github.com/gofiber/fiber/v2" "github.com/gofiber/template/html/v2" ) func main() { var err error engine := html.New("./templates", ".html") app := fiber.New(fiber.Config{ DisableStartupMessage: true, Views: engine, }) app.Static("/", "./public") app.Static("/assets", "./content/assets") app.Get("/", routes.GET_Index) app.Get("/download", routes.GET_Download) app.Get("/news", routes.GET_News) app.Get("/news/feed.atom", routes.GET_NewsFeed) app.Get("/news/feed.rss", routes.GET_NewsFeed) app.Get("/news/feed.json", routes.GET_NewsFeed) app.Get("/news/:id", routes.GET_New) app.Get("/wiki", routes.GET_Wiki) app.Get("/wiki/:id", routes.GET_WikiPage) app.Get("/hub", routes.GET_Configs) app.Get("/hub/:name", routes.GET_Config) app.Get("*", func(c *fiber.Ctx) error { return lib.RenderError(c, 404) }) log.Info("Starting MatterLinux website on port 9878") if err = app.Listen(":9878"); err != nil { log.Error("Error starting server: %s", err.Error()) } }