hanami / hanami/roadmap

Improve per-slice router setup

Open
#17 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
2
Forks
0
PR merge metrics
No merged PRs in 30d

Description

If you have a slice with its own session config and its own router, then doing `slice :my_slice` inside your app routes does _not_ mount its session middleware. Instead you have to `use` it directly in the app slice, and then define all the slice routes there too.

```ruby
module MyApp
class Routes < Hanami::Routes
slice :main, at: "/main" do
use Rack::Session::Cookie,
key: "_my_app.session.main",
secret: "m"*60,
expire_after: 60 * 60 * 24 * 365

root to: "home.show"
end

slice :admin, at: "/admin" do
use Rack::Session::Cookie,
key: "_my_app.session.admin",
secret: "a"*60,
expire_after: 60 * 60 * 24 * 365

root to: "home.show"
end
end
end
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.