up
This commit is contained in:
parent
b8766e37c1
commit
17a9c5835e
3
serve.go
3
serve.go
@ -23,6 +23,9 @@ func (s *Server) Admin() *fiber.App {
|
|||||||
|
|
||||||
a.Post("/shorten", func(c *fiber.Ctx) error {
|
a.Post("/shorten", func(c *fiber.Ctx) error {
|
||||||
shortUrl := c.Query("s")
|
shortUrl := c.Query("s")
|
||||||
|
if shortUrl == "" {
|
||||||
|
shortUrl = s.serverGen.NextID()
|
||||||
|
}
|
||||||
longUrl := string(c.Body())
|
longUrl := string(c.Body())
|
||||||
|
|
||||||
return s.storage.Put(shortUrl, longUrl)
|
return s.storage.Put(shortUrl, longUrl)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user