-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Guides 2.0 #90
Add Guides 2.0 #90
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 Excited we're getting started with these 2.0 guides. Great work :)
# /config/routes.rb | ||
|
||
Hanami.application.routes do | ||
slice :main, at: "/" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we explain how slice routing works here too, at least briefly? There will be more guides about slices, of course, but this will be a new concept to almost everyone so briefly mentioning it's something new to learn could be useful (though the routing portion here is almost trivial and obvious).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also a topic I briefly mentioned in the basic_usage
- Let's discuss if it's better to put it here when I'll push remaining docs :). I've not a strong opinion about it yet.
Add note about Hanami v1.3 requiring Ruby 2
|
||
## Mounting an application | ||
|
||
In Hanami, you can mount any rack application in desired route. If we want to do it, you should use the `mount` keyword. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is in the rack configuration, right? config.ru
rather than a route files?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, is it? I will check, thanks! I know it was in the config in 1.3, but I think I saw it changed in new tests.
Will get back to it! cc: @jodosha
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, it's the router.
@swilgosz I strongly advice to wrap those lines into the following block:
# config/routes.rb
module MyApp
class ApplicationRoutes < Hanami::Application::Routes
mount # ...
end
end
Please be aware that this syntax may change, but at least it's crystal clear of what we're talking about: application routes, and not config.ru
.
I would not use "keyword" but "method" instead. Usually keywords are langs constructs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jodosha ATM Hanami2APplication template does not inherit from Hanami::Application::Routes, but rather passes a block to the main class
https://github.com/hanami/hanami-2-application-template/blob/main/config/routes.rb
|
||
It generates: | ||
|
||
<table class="table table-bordered table-striped"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change this to (GitHub-flavored) Markdown tables? https://github.github.com/gfm/#tables-extension-
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I copied it from existing docs, but if other syntax works better, I don't mind.
Co-authored-by: Sean Collins <[email protected]>
Co-authored-by: Sean Collins <[email protected]>
Reason: We do not recommend handling requests this way, but it is worth mentioning How it works and that it is possible.
Co-authored-by: Sean Collins <[email protected]>
Co-authored-by: Sean Collins <[email protected]>
Co-authored-by: Sean Collins <[email protected]>
Co-authored-by: Sean Collins <[email protected]>
Co-authored-by: Sean Collins <[email protected]>
Co-authored-by: Sean Collins <[email protected]>
Co-authored-by: Sean Collins <[email protected]>
Co-authored-by: Sean Collins <[email protected]>
lib | ||
├── bookshelf | ||
│ ├── action.rb | ||
│ ├── entities |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@swilgosz No biggie, but maybe a tailing slash for directories would improve the readability, e.g.
├── entities/
├── entities.rb
├── foodir/
└── barfile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea! BTW: not sure, if you are aware, but you can suggest changes inside reviews, that I can accept directly as your commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@swilgosz IC, will do next time.
Overview
Guides for Hanami 2.0