mirror of
https://github.com/andwati/url-shortener.git
synced 2026-11-16 15:55:14 +00:00
Added error handling
This commit is contained in:
@@ -2,16 +2,21 @@ package main
|
||||
|
||||
import "github.com/gofiber/fiber/v2"
|
||||
|
||||
|
||||
func main(){
|
||||
func main() {
|
||||
app := fiber.New()
|
||||
|
||||
app.Get("/", hello)
|
||||
|
||||
app.Listen(":3000")
|
||||
err := app.Listen(":3000")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func hello(c *fiber.Ctx) error {
|
||||
c.SendString("Hello, World!")
|
||||
err := c.SendString("Hello, World!")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user