0
posts GET /1/posts(.:format) api/v1/posts#index {:format=>"json"}
POST /1/posts(.:format) api/v1/posts#create {:format=>"json"}
new_post GET /1/posts/new(.:format) api/v1/posts#new {:format=>"json"}
edit_post GET /1/posts/:id/edit(.:format) api/v1/posts#edit {:format=>"json"}
post GET /1/posts/:id(.:format) api/v1/posts#show {:format=>"json"}
PUT /1/posts/:id(.:format) api/v1/posts#update {:format=>"json"}
DELETE /1/posts/:id(.:format) api/v1/posts#destroy {:format=>"json"}
범위 지정 경로를 API를 네임 스페이스는이 방법이 유용 할 때 API 변경 충돌은 없습니다. 경로를 제외하고 ...
우리는 어떻게해야하기 위해, (예를 들어v1
포함)의 경로를 앞에 수 있습니다
- v1_posts
- v1_new_post
- v1_edit_post
- v1_post
:name_prefix => 'v1_'
을 다음과 같이 추가하십시오 :
scope('1', module: 'v1', name_prefix: 'v1_')
하지만 이것은 작동하지 않습니다.
참고 : 그게 도움이 경우는 "v1_foobar_path"
몰라 같은 경로를 제공 레일 3.2.2
시도해보기 https://github.com/intridea/grape – lucapette
빌드가 현재 중단되었으며 내 요구 사항이 과도한 것으로 보입니다. 나는 레일 자체로 그것을하고 싶다. – Doug
당신은 마스터를 사용하지 않아도됩니다. 바퀴의 재발견은 항상 과잉입니다. 하지만 그 느낌을 이해합니다. – lucapette