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

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

As of 1.6.0-rc.0 mix phx.new 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:

20 Likes