Route with domain and/or subdomain ?

40 views
Skip to first unread message

峰朱

unread,
Apr 9, 2013, 1:43:22 AM4/9/13
to espresso-...@googlegroups.com
is the only way to progressing in action's code ?

Silviu Rusu

unread,
Apr 9, 2013, 1:42:57 AM4/9/13
to espresso-...@googlegroups.com
sorry, more details please?


On Apr 9, 2013, at 8:43 AM, 峰朱 <benz...@gmail.com> wrote:

is the only way to progressing in action's code ?

--
You received this message because you are subscribed to the Google Groups "Espresso Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to espresso-framew...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Ben

unread,
Apr 9, 2013, 1:50:50 AM4/9/13
to espresso-...@googlegroups.com
i want abc.com to AbcController, def.com to DefController. how to do this?


--
You received this message because you are subscribed to a topic in the Google Groups "Espresso Framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/espresso-framework/kxjWrMy-O8k/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to espresso-framew...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.
 
 

Silviu Rusu

unread,
Apr 9, 2013, 2:02:33 AM4/9/13
to espresso-...@googlegroups.com
this is planed for 0.5 release. for now it does not handle hosts at all.

it will allow to tie specific controllers/slices to a single or multiple hosts:

app = EspressoApp.new  # or just E.new after 0.4.5 release
app.mount AbcController, host: 'abc.com'
app.mount FooBar, host: ['foo.com', 'bar.com']
# controller serving any subdomain
app.mount Something, host: '*.something.com'
# controller serving only .com TLD
app.mount Com, host: '*.com'

Ben

unread,
Apr 9, 2013, 2:27:58 AM4/9/13
to espresso-framework
that's good, but could code like this?

class App < E
  host 'abc.com'
  map '/'
end

Silviu Rusu

unread,
Apr 9, 2013, 2:28:06 AM4/9/13
to espresso-...@googlegroups.com
good point, will do

Silviu Rusu

unread,
Apr 25, 2013, 10:25:12 AM4/25/13
to espresso-...@googlegroups.com
Hi 峰朱,
just released Espresso 0.4.6,

Tim Uckun

unread,
May 27, 2013, 7:45:09 PM5/27/13
to espresso-...@googlegroups.com
Does this mean I can mount multiple apps running in multiple domains into the same rackup file?

For example.

Say I have two apps completely unrelated one is running on foo.com and the other on bar.com. Can I mount both of them as separate espresso apps with their own controllers, models etc but in the same directory structure like this?

apps/
apps/foo
apps/foo/blah...
apps/bar
apps/bar/blah...

Ideally I would like to be able to share some code between them as well.

Silviu Rusu

unread,
May 27, 2013, 11:42:13 PM5/27/13
to espresso-...@googlegroups.com
You can mount have 2 different slices inside same directory and mount them into different hosts.

For this just put controllers under different namespace:

enginery g:c Forum::Users
enginery g:c Forum::Posts
enginery g:c Cms::Articles
enginery g:c Cms::News

then update base/boot.rb:

E.new :automount do ...
into
E.new do ...

inside "E.new do"  block add:

mount Forum, host: 'forum.com'
mount Cms, host: 'cms.com'

Now your Forum controllers wont run under cms.com and Cms controllers wont run under forum.com

Tim Uckun

unread,
May 28, 2013, 8:40:02 AM5/28/13
to espresso-...@googlegroups.com
This is quite interesting and potentially very powerful as long as both domains are using the same database.  I guess if you wanted to mount different apps in different domains you can use config.ru right?

I really like the idea that you can create all your apps or a bundle of apps in one directory structure and have them all use the same gemset and be able to share code between them. If I use something like puma it would also save tons of RAM.


--
Reply all
Reply to author
Forward
0 new messages