update: general formatting and cleanup
This commit is contained in:
57
main.go
57
main.go
@ -1,6 +1,6 @@
|
||||
/*
|
||||
|
||||
* website | MatterLinux Official Website
|
||||
* website | MatterLinux website
|
||||
* MatterLinux 2023-2024 (https://matterlinux.xyz)
|
||||
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@ -21,44 +21,43 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
|
||||
"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(){
|
||||
log.SetFlags(log.Lshortfile | log.Ltime)
|
||||
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")
|
||||
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("/", routes.GET_Index)
|
||||
app.Get("/download", routes.GET_Download)
|
||||
|
||||
app.Get("/news", routes.NewsRoute)
|
||||
app.Get("/news/:id", routes.PostRoute)
|
||||
|
||||
app.Get("/wiki", routes.WikiMainRoute)
|
||||
app.Get("/wiki/:id", routes.WikiRoute)
|
||||
app.Get("/news", routes.GET_News)
|
||||
app.Get("/news/:id", routes.GET_New)
|
||||
|
||||
app.Get("/hub", routes.ConfigsRoute)
|
||||
app.Get("/hub/:name", routes.ConfigRoute)
|
||||
app.Get("/wiki", routes.GET_Wiki)
|
||||
app.Get("/wiki/:id", routes.GET_WikiPage)
|
||||
|
||||
app.Get("*", func(c *fiber.Ctx) error {
|
||||
return lib.RenderError(c, 404)
|
||||
})
|
||||
app.Get("/hub", routes.GET_Configs)
|
||||
app.Get("/hub/:name", routes.GET_Config)
|
||||
|
||||
log.Println("Starting MatterLinux Website on port 9878")
|
||||
err := app.Listen(":9878")
|
||||
if err != nil {
|
||||
log.Fatalf("Error starting server: %s", err)
|
||||
}
|
||||
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())
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user