docbrown/config/routes/api.rb
Fernando Valverde 8c836430ca
API V1 transition (#17835)
* API Articles v0-v1 restructure

* Remove unused helper

* Bulk move API controllers into concerns + add V1 controllers

* Extract API routes + some fixes

* Fix v1 api_controller authenticate! + add more article_controller specs

* Completed spec/requests/api/v1/articles_spec.rb

* specs up to listings

* All v1 specs except for 9 skips

* mime_types cleanup + authenticate! relocation

Co-authored-by: Fernando Valverde <fernando@visualcosita.com>
2022-06-23 14:26:00 -06:00

54 lines
1.5 KiB
Ruby

namespace :admin do
resources :users, only: [:create]
end
resources :articles, only: %i[index show create update] do
collection do
get "me(/:status)", to: "articles#me", constraints: { status: /published|unpublished|all/ }
get "/:username/:slug", to: "articles#show_by_slug"
get "/latest", to: "articles#index", defaults: { sort: "desc" }
end
end
resources :comments, only: %i[index show]
resources :videos, only: [:index]
resources :podcast_episodes, only: [:index]
resources :users, only: %i[show] do
collection do
get :me
end
end
resources :tags, only: [:index]
resources :follows, only: [:create] do
collection do
get :tags
end
end
namespace :followers do
get :users
get :organizations
end
resources :readinglist, only: [:index]
get "/analytics/totals", to: "analytics#totals"
get "/analytics/historical", to: "analytics#historical"
get "/analytics/past_day", to: "analytics#past_day"
get "/analytics/referrers", to: "analytics#referrers"
resources :health_checks, only: [] do
collection do
get :app
get :database
get :cache
end
end
resources :profile_images, only: %i[show], param: :username
resources :organizations, only: [:show], param: :username do
resources :users, only: [:index], to: "organizations#users"
resources :articles, only: [:index], to: "organizations#articles"
end
resource :instance, only: %i[show]
constraints(RailsEnvConstraint.new(allowed_envs: %w[test])) do
resource :feature_flags, only: %i[create show destroy], param: :flag
end