forked from gofiber/recipes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
36 lines (28 loc) 路 741 Bytes
/
Copy pathmain.go
File metadata and controls
36 lines (28 loc) 路 741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// 鈿★笍 Fiber is an Express inspired web framework written in Go with 鈽曪笍
// 馃 Github Repository: https://github.com/gofiber/fiber
// 馃搶 API Documentation: https://docs.gofiber.io
package main
import (
"log"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/recover"
)
func main() {
// Fiber instance
app := fiber.New(fiber.Config{
// ErrorHandler: func(c *fiber.Ctx, err error) error {
// c.Status(fiber.StatusInternalServerError)
// return c.SendString(err.Error())
// },
})
// Middleware
app.Use(recover.New())
// Routes
app.Get("/", hello)
// Start server
log.Fatal(app.Listen(":3000"))
}
// Handler
func hello(c *fiber.Ctx) error {
panic("No worries, I won't crash! 馃檹")
}