Skip to content

Commit 0a0f7e4

Browse files
authored
Merge pull request #1556 from dm1try/add_information_about_mount_inheritance
Add information about #mount inheritance
2 parents d9c33bb + fcb7c6f commit 0a0f7e4

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,19 @@ class Twitter::API < Grape::API
321321
end
322322
```
323323

324+
Keep in mind such declarations as `before/after/rescue_from` must be placed before `mount` in a case where they should be inherited.
325+
326+
```ruby
327+
class Twitter::API < Grape::API
328+
before do
329+
header 'X-Base-Header', 'will be defined for all APIs that are mounted below'
330+
end
331+
332+
mount Twitter::Users
333+
mount Twitter::Search
334+
end
335+
```
336+
324337
## Versioning
325338

326339
There are four strategies in which clients can reach your API's endpoints: `:path`,

0 commit comments

Comments
 (0)