SendFile
Transfers the file from the given path. Sets the Content-Type response HTTP header field based on the filenames extension.
Method use gzipping by default, set it to true to disable.
c.SendFile(path string, compress ...bool) error
app.Get("/not-found", func(c *fiber.Ctx) {
if err := c.SendFile("./public/404.html"); err != nil {
c.Next(err) // pass err to ErrorHandler
}
// Enable compression
if err := c.SendFile("./static/index.html", true); err != nil {
c.Next(err) // pass err to ErrorHandler
}
})