Reputation: 135
I worked with Spree and I found this line in while doing 'rake routes'
api GET|POST|PUT|PATCH|DELETE /api/v:api/*path(.:format) redirect(301) {:format=>"json"}
GET|POST|PUT|PATCH|DELETE /api/*path(.:format) redirect(301) {:format=>"json"}
What does it mean? what is v:api and what is redirect(301)? I know what redirect(301) is but what will be the new route?
Upvotes: 1
Views: 217
Reputation: 6942
Assuming you're on the latest version of Spree, that route is likely generated by this code: https://github.com/spree/spree/blob/f68afc19515b78d151c2663927678901954ea435/api/config/routes.rb#L171-L191
Based on that code it looks like some kind of redirect for legacy api/v1
requests. If I'm reading that code correctly, it seems Spree wants to override some of those routes in order to redirect to the v1
namespace. The 301 is just the status for the redirect and it forwards the request as JSON
Upvotes: 1