- Add route in config/routes.rb
namespace :api, defaults: { format: :json } do
namespace :v1 do
resources :stories, only: [:index]
end
end
- Add action in controllers/api/v1/stories_controller.rb
def index
end
- Add view if needed in views/api/v1/stories/index.json.jbuilder
index.json.jbuilder