32 lines
504 B
Go
32 lines
504 B
Go
package main
|
|
|
|
import (
|
|
"git.tijl.dev/tijl/shortify"
|
|
"github.com/gofiber/fiber/v2"
|
|
)
|
|
|
|
func main() {
|
|
s, err := shortify.New(shortify.Config{
|
|
DataFolder: "./shoritfy",
|
|
})
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
// 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")
|
|
|
|
}
|