56 lines
1.6 KiB
Go
56 lines
1.6 KiB
Go
/*
|
|
|
|
* website | MatterLinux Official Website
|
|
* Copyright (C) 2024 Matterlinux
|
|
|
|
* 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 <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
package main
|
|
|
|
import (
|
|
"git.matterlinux.xyz/Matter/website/lib"
|
|
"git.matterlinux.xyz/Matter/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{
|
|
DisableStartupMessage: true,
|
|
Views: engine,
|
|
})
|
|
app.Static("/", "./public")
|
|
app.Static("/assets", "./content/assets")
|
|
|
|
app.Get("/", routes.IndexRoute)
|
|
app.Get("/download", routes.DownloadRoute)
|
|
|
|
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.Info("Starting MatterLinux Website on port 9878")
|
|
log.Fatal(app.Listen(":9878"))
|
|
}
|