Cookies

This recipe will help you to setup a cookie in your application.

First you need an amber project generated with Amber CLI or from scratch.

src/controllers/some_controller.cr
```ruby class SomeController < ApplicationController def set_cookie cookies[:example] = { value: "a yummy cookie with amber color", http_only: true, secure: true } "Your example cookie has been cooked successfully!" end end ```

Then in your routes file:

config/routes.cr
```ruby Amber::Server.configure do |app| pipeline :web do # pipelines... end

routes :web do # other routes,,, get "/set_cookie", SomeController, :set_cookie end end

</div>


Also see more detailed information about this in[ Cookies Guide](/docs/guides/controllers/cookies).