up
This commit is contained in:
@@ -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")
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user