This commit is contained in:
2025-08-06 17:38:23 +02:00
parent 4f291c93e5
commit 3892d966f3
17 changed files with 831 additions and 490 deletions

View File

@@ -2,18 +2,30 @@ package main
import (
"git.tijl.dev/tijl/shortify"
"github.com/gofiber/fiber/v2"
)
func main() {
s, err := shortify.NewShortener(shortify.Config{
DataFolder: "./shortify",
CacheSize: 10000,
AccessLogSize: 10000,
s, err := shortify.New(shortify.Config{
DataFolder: "./shoritfy",
})
if err != nil {
panic(err)
}
go s.ServeSocket("./data/shortify.sock")
s.ServeHTTP("0.0.0.0:3001")
// listen the admin interface
unixListener, err := shortify.GetUnixListener("./shortify/admin.sock")
go s.Admin().Listener(unixListener)
// listen the interface for normies
a := fiber.New()
a.Get("/shorten", s.HandlePostURL())
a.Get("/s/:id", s.HandleGetURL())
a.Listen(":3001")
}