The « —live" option (phoenix 1.6.0.rc) does not seem to work properly

When generating a new app with live 1.6.0-rc.0 with “mix pento —live”

  1. no lib/pento_web/live was created.
  2. in section scope “/”, PentoWeb (router.ex), I see a
  • get “/”, PageController, :index
  • instead of live “/”, PageLive, :index
    Could anyone tell me what I missed here ?


1 Like

Welcome @gareyte – you didn’t miss anything! Here’s what happened:

As of 1.6.0-rc.0 mix includes LiveView by default, but it no longer generates a live route for the homepage. This has been retroactively added to the changelog, sorry for the confusion!

Below I have included instructions for how to make one instead :slight_smile: We will give it a slightly different name to avoid any confusion when it comes to routes, so let’s call it MyPageLive.

First, create the following files (you can find the contents in this gist):

$ touch lib/pento_web/live/my_page_live.ex
$ touch lib/pento_web/live/my_page_live.html.heex

Next, add the following to your router scope, just under get “/”, PageController, :index:

live "/my", MyPageLive, :index

Then, start the server:

$ mix phx.server --open

Finally, navigate to http://localhost:4000/my and you should see page with a search bar in the hero section.

Let us know how it goes! :slight_smile:



Thanks so much for your time and clear explanations !

Meanwhile, I had ended up with a setup similar to the one you propose.

As an elixir fan and phoenix newbie, your feedback makes me feel even better :wink:

The whole stack and community/contributers really impress me.

Kind regards