1
0
Fork 0
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:
Severin Schoepke 2021-05-12 13:56:36 +02:00
parent f55010a179
commit 71e10a00e3

View file

@ -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`: