An open API service indexing awesome lists of open source software.

https://github.com/rktjmp/phx-necromancy


https://github.com/rktjmp/phx-necromancy

Last synced: 7 months ago
JSON representation

Awesome Lists containing this project

README

          

# Just sharing this code as a short example attached to the forum, not indicitive of best practices but maybe useful as a starting point.

The following readme was written to myself and is not prescriptive, instructive or well considered.

# Necromancy

Using Phoenix.LiveView inplace of classical controllers, optionally
resurrecting them from the dead.

## Reasoning

- A consistent developer experience.

All your views are constructed in the same manner, with a mount, handle_params,
etc process flow. The "template render flow" is the same.

- But not all views really need to be "live"

Some static [sic] pages have no sever state to update. These could/can just be
regular Phoenix controller actions.

- But, but some views might warrant starting dead and then *becoming* live.

## Reasons against

- Kinda weird
- Added complexity with expecting a liveview to never connect?
- Phoenix 1.7 *may* unify how templates are put together with the new
templating engine?

## Direct usecase

All pages show content, with a "live chat/form" pop-out. The live-chat should
integrate with the current page - it should not redirect.

## Methods

- Show button, on click spawn iframe with liveview in it, let this do the fancy
work.
- Simpler, no hacks
- iframes ugly?

- Dead to live
- render view as dead-liveview, on click connect livesocket or import livesocket code