Cookie
Set cookie
Signature
c.Cookie(*Cookie)
- type Cookie struct {
- Name string
- Value string
- Path string
- Domain string
- Expires time.Time
- Secure bool
- HTTPOnly bool
- SameSite string // lax, strict, none
- }
- app.Get("/", func(c *fiber.Ctx) {
- // Create cookie
- cookie := new(fiber.Cookie)
- cookie.Name = "john"
- cookie.Value = "doe"
- cookie.Expires = time.Now().Add(24 * time.Hour)
- // Set cookie
- c.Cookie(cookie)
- })