Last active
August 20, 2019 15:09
-
-
Save vegg89/b4363641df20351754c483f1cba88e5d to your computer and use it in GitHub Desktop.
LiveView installation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import "../../deps/phoenix_live_view/assets/css/live_view.css"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Configures the endpoint | |
config :phoenix_observer, PhoenixObserverWeb.Endpoint, | |
url: [host: "localhost"], | |
secret_key_base: "HZeXYAfTEvY59ZdUBBI7yRTqBXZITAAjv6pYMeRg0art4EQmVYWhPeOuijMF9r4y", | |
render_errors: [view: PhoenixObserverWeb.ErrorView, accepts: ~w(html json)], | |
pubsub: [name: PhoenixObserver.PubSub, adapter: Phoenix.PubSub.PG2], | |
live_view: [ | |
signing_salt: "JT9vHYpcubGCuh+83mpKBQrH9NT9nZyb" | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config :phoenix_observer, PhoenixObserverWeb.Endpoint, | |
live_reload: [ | |
patterns: [ | |
~r"priv/static/.*(js|css|png|jpeg|jpg|gif|svg)$", | |
~r"priv/gettext/.*(po)$", | |
~r"lib/phoenix_observer_web/{live,views}/.*(ex)$", | |
~r"lib/phoenix_observer_web/templates/.*(eex)$", | |
~r{lib/phoenix_observer/live/.*(ex)$} | |
] | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
socket "/live", Phoenix.LiveView.Socket |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{:plug_cowboy, "~> 2.0"}, | |
{:phoenix_live_view, github: "phoenixframework/phoenix_live_view"}, | |
{:recon, "~> 2.5} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"dependencies": { | |
"phoenix": "file:../deps/phoenix", | |
"phoenix_html": "file:../deps/phoenix_html", | |
"phoenix_live_view": "file:../deps/phoenix_live_view" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule PhoenixObserverWeb do | |
def controller do | |
quote do | |
import Phoenix.LiveView.Controller, only: [live_render: 3] | |
alias PhoenixObserverWeb.Router.Helpers, as: Routes | |
end | |
end | |
def view do | |
quote do | |
import Phoenix.LiveView, only: [live_render: 2, live_render: 3, live_link: 1, live_link: 2] | |
# Use all HTML functionality (forms, tags, etc) | |
use Phoenix.HTML | |
end | |
end | |
def router do | |
quote do | |
import Phoenix.LiveView.Router | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pipeline :browser do | |
plug :accepts, ["html"] | |
plug :fetch_session | |
plug :fetch_flash | |
plug Phoenix.LiveView.Flash | |
plug :protect_from_forgery | |
plug :put_secure_browser_headers | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment