thiagomajesk
Concept of "area" in Phoenix project structure
Hi! I was wondering if we have something similar to the concept of “areas” in ASP.NET MVC for Phoenix.
It’s nothing really complicated; In its essence, it’s just a folder structure, but ASP.NET generators support the concept of aggregating controllers/ views and routes inside an “area” by default (Please don’t confuse this with Phoenix contexts, “areas” are meant as a web-app-only organization structure).
Most Liked
tme_317
I think it’s fine to customize your folder structure however you like and it’s not “going off the rails” as Elixir/Phoenix is flexible and doesn’t really care. You can co-locate your templates with your controller and view by making this tweak: Domain-oriented web folder structure with further discussion here: Discussion about domain-orientated folder structures in Phoenix
jeremyjh
I wrote about a similar idea awhile back. We found this structure helpful especially for server-rendered apps its easier to navigate if you keep templates with the controller and view. Its very easy to tweak the Phoenix generated macros to customize things the way you want to. And if you don’t have templates, you don’t have to tweak anything if you want to keep your view and controller together.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









