28 lines
542 B
Go
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)
|
||
|
}
|