@idunnowhatimdoing

Raw-Dogging Phoenix LiveView ~ 2024.08.30 @ 13.38

I recently learnt that what I do with my website, basically just html, css and js, no framework, is called raw-dogged website.

I decided to make a raw-dogged version of phoenix liveview. Let's get on with it.

First, we need a router. Phoenix needs router so here's a simple router.

Router for Phoenix

All good so far. Now, we need our liveview module to handle the route, we named HomeLive.

HomeLive

Next, we need to define our Endpoint module. For now the following is enough.

Endpoint

In order to start the supervisor with Endpoint module we need to define some app vars.

Missing libs And finally, we need to start our IEx HomeLive

Of course, classic idiot. I need to install the libraries. Duh! For that, there's a nice trick from Mix.

Mix

Ok, now we have a diff error. Crap.

ErrorView

Apparenty, I need to defined the error_view [1].

ErrorView module

And voila! Server is up.

Server up

Final step is to actually connect to the websocket which is not as you can see in the above image.

Let's update our HomeView to have the correct versions for phoenix and phoenix liveview.

Server up

And update also the render to have the respective scripts.

Server up

Presto! It works. Next time, let's make something more complex than just this.

Server up complete .exs