mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Add example for proc-based route to Routing guide
This commit is contained in:
parent
f55010a179
commit
71e10a00e3
1 changed files with 2 additions and 0 deletions
|
@ -920,6 +920,8 @@ As long as `MyRackApp` responds to `call` and returns a `[status, headers, body]
|
|||
|
||||
NOTE: For the curious, `'articles#index'` actually expands out to `ArticlesController.action(:index)`, which returns a valid Rack application.
|
||||
|
||||
NOTE: Since procs/lambdas are objects that happen to respond to `call` you can implement very simple routes (e.g. for health checks) inline:<br>`get '/health', to: ->(env) { [204, {}, ''] }`
|
||||
|
||||
If you specify a Rack application as the endpoint for a matcher, remember that
|
||||
the route will be unchanged in the receiving application. With the following
|
||||
route your Rack application should expect the route to be `/admin`:
|
||||
|
|
Loading…
Reference in a new issue