rack-vhost 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +26 -0
- data/examples/config.ru +2 -2
- data/lib/rack/vhost.rb +1 -1
- data/rack-vhost.gemspec +1 -1
- metadata +1 -1
data/README.md
CHANGED
|
@@ -2,3 +2,29 @@ rack-vhost
|
|
|
2
2
|
==========
|
|
3
3
|
|
|
4
4
|
Rack middleware to dispatch to an application via host header.
|
|
5
|
+
|
|
6
|
+
Example config.ru:
|
|
7
|
+
|
|
8
|
+
require 'rack/vhost'
|
|
9
|
+
|
|
10
|
+
class Router
|
|
11
|
+
def call(env)
|
|
12
|
+
[200, { 'Content-Type' => 'text/plain' }, 'Router app']
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
class APIApp
|
|
17
|
+
def call(env)
|
|
18
|
+
[200, { 'Content-Type' => 'text/plain' }, 'API app']
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
class MainApp
|
|
23
|
+
def call(env)
|
|
24
|
+
[200, { 'Content-Type' => 'text/plain' }, 'Main app']
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
use Rack::Vhost, :vhost => '^api', :app => APIApp.new
|
|
29
|
+
use Rack::Vhost, :vhost => 'www.philcolabs.com', :app => MainApp.new
|
|
30
|
+
run Router.new
|
data/examples/config.ru
CHANGED
|
@@ -18,6 +18,6 @@ class MainApp
|
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
-
use Rack::Vhost, :vhost =>
|
|
22
|
-
use Rack::Vhost, :vhost =>
|
|
21
|
+
use Rack::Vhost, :vhost => '^api', :app => APIApp.new
|
|
22
|
+
use Rack::Vhost, :vhost => 'www.philcolabs.com', :app => MainApp.new
|
|
23
23
|
run Router.new
|
data/lib/rack/vhost.rb
CHANGED
data/rack-vhost.gemspec
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Gem::Specification.new do |gem|
|
|
2
2
|
gem.name = 'rack-vhost'
|
|
3
|
-
gem.version = '0.1.
|
|
3
|
+
gem.version = '0.1.2'
|
|
4
4
|
gem.summary = 'Rack middleware to dispatch to an application via host header'
|
|
5
5
|
gem.description = 'Rack middleware to dispatch to an application via host header.'
|
|
6
6
|
gem.author = 'Philip Reichenberger'
|