Skip to content

Instantly share code, notes, and snippets.

@sweeneydavidj
Last active May 28, 2021 13:55
Show Gist options
  • Save sweeneydavidj/1daa26eb4bc5798ad7b564abf854cd2b to your computer and use it in GitHub Desktop.
Save sweeneydavidj/1daa26eb4bc5798ad7b564abf854cd2b to your computer and use it in GitHub Desktop.
Phoenix Intro

Phoenix Intro

Elixir Docs

https://elixir-lang.org/docs.html

6 core projects

Phoenix Docs

https://www.phoenixframework.org/

Create Phoenix App

Follow tutorial to create Phoenix hello application...

https://hexdocs.pm/phoenix/up_and_running.html#content

DB

pgAdmin4 desktop only

See this SO question for tips for installation...

https://stackoverflow.com/questions/58239607/pgadmin-package-pgadmin4-has-no-installation-candidate

Navigate to schema_migrations table

mix phx.gen.html

Follow tutorial to create new page etc...

https://hexdocs.pm/phoenix/Mix.Tasks.Phx.Gen.Html.html#content

Add record and check DB

Eyeball Phoenix files

/config/config.exs

/config/dev.exs

/lib/hello_web/endpoint.ex

/lib/hello_web/router.ex

/lib/hello_web/controllers/UserController.ex - show/2

mix phx.server

iex -S mix

iex -S mix phx.server

Inside show/2 add...

IO.inspect(user)

/lib/hello_web/templates/user/show.html.eex

Routes

mix phx.routes

A little deeper using IEX

alias Hello.Repo

alias Hello.Accounts.User

Repo.get!(User, id)

Unit tests

mix test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment