Learning Elixir and Pheonix Framework with the Backend Stuff - Phoenix Framework Tutorial on Youtube.
- Make sure to have docker container created and running (see commands below)
- See below for running Pheonix server
# pull docker postgress image
docker pull postgres
# create docker container (add your own user/pass)
docker run --name bs_db -p 5432:5432 -e POSTGRES_USER=XXX -e POSTGRES_PASSWORD=XXX -d postgres
# view container info
docker inspect bs_db
# install pheonix
mix archive.install hex phx_new
# create backend-only pheonix app
mix phx.new real_deal_api --no-install --app real_deal_api --database postgres --no-live --no-assets --no-html --no-dashboard --no-mailer --binary-id
# install deps
mix deps.get
# create db
mix ecto.create
# enter postgres shell (in docker terminal)
psql -U root bs_db
# run the app
mix phx.server
#generate a JSON controller called Accounts, module Account, db table account, that has email and hash_password columns of type string
mix phx.gen.json Accounts Account account email:string hash_password:string
To start your Phoenix server:
- Run
mix setup
to install and setup dependencies - Start Phoenix endpoint with
mix phx.server
or inside IEx withiex -S mix phx.server
Now you can visit localhost:4000
from your browser.
Ready to run in production? Please check our deployment guides.
- Official website: https://www.phoenixframework.org/
- Guides: https://hexdocs.pm/phoenix/overview.html
- Docs: https://hexdocs.pm/phoenix
- Forum: https://elixirforum.com/c/phoenix-forum
- Source: https://github.com/phoenixframework/phoenix