File tree Expand file tree Collapse file tree 4 files changed +17
-8
lines changed Expand file tree Collapse file tree 4 files changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -10,8 +10,6 @@ RUN bundle install --system
1010ADD . /app
1111RUN bundle install --system
1212
13- ENV VIRTUAL_HOST=api.example.com
14-
1513EXPOSE 9292
1614
1715CMD ["bundle" , "exec" , "rackup" ]
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ gem 'puma', '3.4.0'
77gem 'rack-test'
88gem 'rake'
99gem 'sinatra'
10+ gem "sinatra-namespace"
1011gem 'sinatra-subdomain'
1112gem 'sinatra-cross_origin'
1213gem 'test-unit'
Original file line number Diff line number Diff line change 11GEM
22 remote: https://rubygems.org/
33 specs:
4+ backports (3.8.0 )
45 bson (4.2.2 )
56 foreman (0.84.0 )
67 thor (~> 0.19.1 )
78 json (2.1.0 )
89 mongo (2.4.2 )
910 bson (>= 4.2.1 , < 5.0.0 )
11+ multi_json (1.12.1 )
1012 mustermann (1.0.0 )
1113 power_assert (1.0.2 )
1214 puma (3.4.0 )
2123 rack (~> 2.0 )
2224 rack-protection (= 2.0.0 )
2325 tilt (~> 2.0 )
26+ sinatra-contrib (2.0.0 )
27+ backports (>= 2.0 )
28+ multi_json
29+ mustermann (~> 1.0 )
30+ rack-protection (= 2.0.0 )
31+ sinatra (= 2.0.0 )
32+ tilt (>= 1.3 , < 3 )
2433 sinatra-cross_origin (0.4.0 )
34+ sinatra-namespace (1.0 )
35+ sinatra-contrib
2536 sinatra-subdomain (0.3.0 )
2637 sinatra
2738 test-unit (3.2.5 )
@@ -41,6 +52,7 @@ DEPENDENCIES
4152 rake
4253 sinatra
4354 sinatra-cross_origin
55+ sinatra-namespace
4456 sinatra-subdomain
4557 test-unit
4658
Original file line number Diff line number Diff line change 66
77require 'bundler/setup'
88require 'sinatra'
9+ require "sinatra/namespace"
910require 'sinatra/subdomain'
1011require 'sinatra/cross_origin'
1112require 'json'
1213require 'mongo'
1314
14- # Allow connections other than localhost
15- set :bind , '0.0.0.0'
16-
1715# Uses the modular version of Sinatra
1816class SpacexAPI < Sinatra ::Base
19- register Sinatra ::Subdomain
17+ register Sinatra ::Namespace
2018 register Sinatra ::CrossOrigin
2119
2220# Enable CORS
@@ -57,8 +55,8 @@ class SpacexAPI < Sinatra::Base
5755# redirect request.url.sub('http', 'https') unless request.secure?
5856# end
5957
60- # Uses subdomain api.example.com to route traffic
61- subdomain : api do
58+ # Sets namespace for all following URL's
59+ namespace '/ api/v1' do
6260
6361##########################################
6462# Basic Info Endpoints
You can’t perform that action at this time.
0 commit comments