[middleware-ordering] Improve middlware docs, fixes #51
This commit is contained in:
parent
f830396dbf
commit
16c1ba76ed
13
README.md
13
README.md
@ -25,9 +25,12 @@ Then add the middleware to your Rails middleware stack by editing your `config/e
|
|||||||
# config/environments/development.rb
|
# config/environments/development.rb
|
||||||
|
|
||||||
MyApp::Application.configure do
|
MyApp::Application.configure do
|
||||||
# Add Rack::LiveReload to the bottom of the middleware stack with the default options.
|
# Add Rack::LiveReload to the bottom of the middleware stack with the default options:
|
||||||
config.middleware.insert_after ActionDispatch::Static, Rack::LiveReload
|
config.middleware.insert_after ActionDispatch::Static, Rack::LiveReload
|
||||||
|
|
||||||
|
# or, if you're using better_errors:
|
||||||
|
config.middleware.insert_before Rack::Lock, Rack::LiveReload
|
||||||
|
|
||||||
# ...
|
# ...
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
@ -45,7 +48,11 @@ config.middleware.use(Rack::LiveReload,
|
|||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
In addition, Rack::LiveReload's position within middleware stack can be specified by inserting it relative to an exsiting middleware via `insert_before` or `insert_after`. See the [Rails on Rack: Adding a Middleware](http://guides.rubyonrails.org/rails_on_rack.html#adding-a-middleware) section for more detail.
|
In addition, Rack::LiveReload's position within middleware stack can be
|
||||||
|
specified by inserting it relative to an exsiting middleware via
|
||||||
|
`insert_before` or `insert_after`. See the [Rails on Rack: Adding a
|
||||||
|
Middleware](http://guides.rubyonrails.org/rails_on_rack.html#adding-a-middleware)
|
||||||
|
section for more detail.
|
||||||
|
|
||||||
### Sinatra / config.ru
|
### Sinatra / config.ru
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user