I’m building a web app, but I want to have some marketing pages (welcome page for sure, but maybe some contact, etc.) Is there a common or best practice for defining the routes?
In various apps I’ve seen the following:
Is this doable with a single Phoenix app?
I have some marketing pages in a couple of my apps. If they don’t lend themselves to specific controllers, I usually just add them as actions in PageController
with a few routes…
get "/", PageController, :index
get "/careers", PageController, :careers
get "/contact", PageController, :contact
post "/contact_request", PageController, :contact_request
get "/terms-and-conditions", PageController, :terms_and_conditions
My marketing and admin areas use mostly the same layouts and assets so this works fine and both are under the same domain. I might move to multiple Phoenix apps to more fully separate the marketing and admin areas in the future.
3 Likes