Added error handling

This commit is contained in:
2024-06-19 03:19:08 +02:00
parent cfad6759a5
commit 5dc82d3b5b
6 changed files with 43 additions and 6 deletions
+10 -5
View File
@@ -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
}
}