https://github.com/sujit-baniya/flash
This package is build to send the flash messages on the top of Gofiber
https://github.com/sujit-baniya/flash
cookies fiber flash-messages gofiber golang
Last synced: 4 months ago
JSON representation
This package is build to send the flash messages on the top of Gofiber
- Host: GitHub
- URL: https://github.com/sujit-baniya/flash
- Owner: sujit-baniya
- License: mit
- Created: 2020-07-05T06:33:39.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2025-08-21T08:31:36.000Z (10 months ago)
- Last Synced: 2025-08-21T10:36:54.140Z (10 months ago)
- Topics: cookies, fiber, flash-messages, gofiber, golang
- Language: Go
- Homepage:
- Size: 24.4 KB
- Stars: 31
- Watchers: 2
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Set flash message for routes.
This package is build to send the flash messages on the top of Gofiber
## Installation
The package can be used to validate the data and send flash message to other route.
> go get github.com/sujit-baniya/flash
## Usage
```go
package main
import (
"github.com/gofiber/fiber/v2"
"github.com/sujit-baniya/flash"
)
func main() {
app := fiber.New()
app.Get("/success-redirect", func(c *fiber.Ctx) error {
return c.JSON(flash.Get(c))
})
app.Get("/error-redirect", func(c *fiber.Ctx) error {
flash.Get(c)
return c.JSON(flash.Get(c))
})
app.Get("/error", func(c *fiber.Ctx) error {
mp := fiber.Map{
"error": true,
"message": "I'm receiving error with inline error data",
}
return flash.WithError(c, mp).Redirect("/error-redirect")
})
app.Get("/success", func(c *fiber.Ctx) error {
mp := fiber.Map{
"success": true,
"message": "I'm receiving success with inline success data",
}
return flash.WithSuccess(c, mp).Redirect("/success-redirect")
})
app.Get("/data", func(c *fiber.Ctx) error {
mp := fiber.Map{
"text": "Received arbitrary data",
}
return flash.WithData(c, mp).Redirect("/success-redirect")
})
app.Listen(":8080")
}
```