diff --git a/config/application.rb b/config/application.rb index b86316c960..cb4160c647 100644 --- a/config/application.rb +++ b/config/application.rb @@ -113,6 +113,7 @@ module Openfoodnetwork ) config.paths["config/routes"] = %w( + config/routes/api.rb config/routes.rb config/routes/admin.rb config/routes/spree.rb diff --git a/config/routes.rb b/config/routes.rb index ac889a2d52..6e7df6ea64 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -88,38 +88,6 @@ Openfoodnetwork::Application.routes.draw do get '/:id/shop', to: 'enterprises#shop', as: 'enterprise_shop' get "/enterprises/:permalink", to: redirect("/") # Legacy enterprise URL - namespace :api do - resources :enterprises do - post :update_image, on: :member - get :managed, on: :collection - get :accessible, on: :collection - - resource :logo, only: [:destroy] - resource :promo_image, only: [:destroy] - - member do - get :shopfront - end - end - - resources :order_cycles do - get :managed, on: :collection - get :accessible, on: :collection - end - - resources :orders, only: [:index] - - resource :status do - get :job_queue - end - - resources :customers, only: [:index, :update] - - resources :enterprise_fees, only: [:destroy] - - post '/product_images/:product_id', to: 'product_images#update_product_image' - end - get 'sitemap.xml', to: 'sitemap#index', defaults: { format: 'xml' } # Mount engine routes diff --git a/config/routes/api.rb b/config/routes/api.rb new file mode 100644 index 0000000000..99c7f76eda --- /dev/null +++ b/config/routes/api.rb @@ -0,0 +1,33 @@ +Openfoodnetwork::Application.routes.draw do + namespace :api do + resources :enterprises do + post :update_image, on: :member + get :managed, on: :collection + get :accessible, on: :collection + + resource :logo, only: [:destroy] + resource :promo_image, only: [:destroy] + + member do + get :shopfront + end + end + + resources :order_cycles do + get :managed, on: :collection + get :accessible, on: :collection + end + + resources :orders, only: [:index] + + resource :status do + get :job_queue + end + + resources :customers, only: [:index, :update] + + resources :enterprise_fees, only: [:destroy] + + post '/product_images/:product_id', to: 'product_images#update_product_image' + end +end