Skip to content

Commit fcb7c6f

Browse files
committed
Add information about #mount inheritance
closes #646 [ci skip]
1 parent d9c33bb commit fcb7c6f

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)