Commit 0417e5d9 authored by Michael Rose's avatar Michael Rose

move /stories/:id to /api/v1/stories/:id

parent ac728a8d
class StoriesController < ApplicationController
class Api::V1::StoriesController < ApplicationController
before_action :set_story, only: [:show]
respond_to :json
......
......@@ -6,7 +6,7 @@ class Rack::Attack
# Throttle story id lookups
Rack::Attack.throttle('/stories/by_id', limit: 10, period: 1.minute) do |req|
req.ip if req.path.starts_with? '/stories'
req.ip if req.path.starts_with? '/api/v1/stories'
end
# Throttle searches
......
......@@ -33,7 +33,11 @@ Rails.application.routes.draw do
post 'pensieve#bookmark' => 'pensieve#bookmark'
match 'pensieve#bookmark' => 'pensieve#bookmark', :via => :options
get 'stories/:id' => 'stories#show', :defaults => { :format => 'json' }
namespace :api do
namespace :v1 do
get 'stories/:id' => 'stories#show', :defaults => { :format => 'json' }
end
end
get '/404', :to => 'errors#not_found'
get '/422', :to => 'errors#unacceptable'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment