This commit is contained in:
Tijl 2025-08-06 19:31:38 +02:00
parent b8766e37c1
commit aa39d7c69c
Signed by: tijl
GPG Key ID: DAE24BFCD722F053

View File

@ -23,6 +23,9 @@ func (s *Server) Admin() *fiber.App {
a.Post("/shorten", func(c *fiber.Ctx) error {
shortUrl := c.Query("s")
if shortUrl == "" {
shortUrl = s.serverGen.NextID()
}
longUrl := string(c.Body())
return s.storage.Put(shortUrl, longUrl)