Last active
August 29, 2015 14:06
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem "subdomain-fu" | |
gem "subdomain_routes" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Api | |
class V1::ProjectsController < ApplicationController | |
def index | |
render :text => "API v1 under construction!" | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActionController::Routing::Routes.draw do |map| | |
map.subdomain :api do |api| | |
api.namespace :v1 do |v1| | |
v1.resources :projects | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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