leech/main.go
2024-04-27 12:16:43 +02:00

28 lines
542 B
Go

package main
import (
"leech/config"
"leech/route"
"path"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/logger"
)
func main() {
app := fiber.New()
app.Use(logger.New(logger.Config{
Format: "[${ip}]:${port} ${status} - ${method} ${path}\n",
}))
app.Get("/:req", route.HandleList)
app.Get("/", route.HandleList)
app.Static("/assets", path.Join(config.InstallDir, "assets"))
for dirName, dirToServe := range config.ServeDirs {
app.Static("/serve/"+dirName, dirToServe)
}
app.Listen(config.Host)
}