live-view-phoenix's People
live-view-phoenix's Issues
LiveView basic
Starting with LiveView
A basic Live module has a mount/3
function which has the params, session data and socket of the connection and the render/1
function which renders the template:
defmodule LiveViewAppWeb.CounterLive do
use Phoenix.LiveView
def mount(_params, _session, socket) do
{:ok, assign(socket, :counter, 0)}
end
def render(assigns) do
~L"""
<label>Counter: <%= @counter %></label>
<button phx-click="incr">+</button>
"""
end
end
To create a live context keeping in mind a timeline of posts:
mix phx.gen.live Timeline Post posts username body likes_count:integer reposts_count:integer
Twitter like app
- Created a basic application with a CRUD of posts.
- Broadcast reloading to all the sessions when creating and updating posts.
- Updating with temporary assigns to optimization.
Deployment
Releases
To generate simple files for releases we can use:
mix release.init
To build the release of the project:
MIX_ENV=prod mix release
To run the built release application:
_build/prod/rel/live_view_app/bin/live_view_app start
Configuration for Heroku
Buildpacks:
https://github.com/HashNuke/heroku-buildpack-elixir.git
https://github.com/behe/heroku-buildpack-phoenix-static
https://github.com/gigalixir/gigalixir-buildpack-distillery.git
Distillery dependency
{:distillery, "~> 2.0", warn_missing: false}
Procfile:
web: /app/_build/prod/rel/phoenix_deploy/bin/phoenix_deploy foreground
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.