DEV Community

Cover image for Building a Rails App With Multiple Subdomains

Building a Rails App With Multiple Subdomains

Prathamesh Sonpatki on March 25, 2020

In today's post, we'll learn how to build a Rails app that can support multiple subdomains. Let's assume that we have a gaming website funkygames.c...
Collapse
 
cescquintero profile image
Francisco Quintero 🇨🇴

Wow, this is such a new approach to use subdomain constraint. I've always used it like this when building APIs:

namespace 'api', defaults: { format: 'json' }, constraints: { subdomain: /api/ }, path: '/' do
  # routes
end
Enter fullscreen mode Exit fullscreen mode

and always forced myself to go this way when having multiple subdomains. Good to know there're more ways to do this!

Thanks for sharing :D