Skip to content

Instantly share code, notes, and snippets.

@pachisaez
Last active August 29, 2015 14:06
Show Gist options
  • Save pachisaez/4aafe254f3d839a87d6b to your computer and use it in GitHub Desktop.
Save pachisaez/4aafe254f3d839a87d6b to your computer and use it in GitHub Desktop.
Configuring subdomains so we can access our API thorugh URLs like http://api.facilethings.com/v1
gem "subdomain-fu"
gem "subdomain_routes"
module Api
class V1::ProjectsController < ApplicationController
def index
render :text => "API v1 under construction!"
end
end
end
ActionController::Routing::Routes.draw do |map|
map.subdomain :api do |api|
api.namespace :v1 do |v1|
v1.resources :projects
end
end
end
SubdomainFu.tld_sizes = { :development => 1,
:test => 1,
:production => 1 }
SubdomainFu.mirrors = %w(www)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment