ariandanim
I am planning make some static page so,
I am making 2 subfolder in controller like this :
frontend
backend
for frontend folder i make subfolder like this :
fe_landing
for backend folder i make subfolder like this :
be_landing
for fe_landing folder i make file like this :
home.html.heex
about.html.heex
service.html.heex
contact.html.heex
for be_landing folder i make file like this :
home_controller.ex
home_html.ex
about_controller.ex
about_html.ex
service_controller.ex
service_html.ex
contact_controller.ex
contact_html.ex
in my home_controller.ex i code like this :
defmodule MyappWeb.Backend.BeLanding do
use MyappWeb, :controller
def home(conn, _params) do
render(conn, :home, layout: false)
end
end
in my home_html.ex i code like this :
defmodule MyappWeb.HomeHTML do
use MyappWeb, :html
embed_templates "../../frontend/fe_landing/*"
end
in my router.ex i code like this :
scope "/", MyappWeb do
pipe_through :browser
get "/fe_landing", HomeController, :home
end
when to running this app, showing error like this :
Phoenix.Router.NoRouteError at GET /
no route found for GET / (Myapp.Router)
i would like to change the default page_controller.ex and page_html.ex is to subfolder controller → backend → be_landing home_controller.ex and home_html.ex, i mean i don’t want to use that page_controller.ex and page_html.ex
how to solved that
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #code-sync
- #discussion
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #ai
- #elixirconf-us
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #blog-post
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #security
- #elixirconf-eu
- #processes
- #api
- #forms
- #hex











Showing Posts 1 to 2- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
ariandanim
for at this time, my folder structure is correct, but i don’t know to route the file home.html.heex in subfolder controller → backend → be_landing to become default main page when users access for the first time
ariandanim
for the temporary solution i’ve found just make the file page_controller.ex and page_html.ex is the main page, and when users try access about page and want to go back homepage just go automatically into page.html.heex
this is the code i solved by my self but not sure, perhaps dear all you have some suggestion
for now, in my route like this
update
I just remove the PageController, :index then edit the “/home”, HomeController, :home become “/”, HomeController, :home