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.
Learn Course: https://www.youtube.com/playlist?list=PL2Rv8vpZJz4x1Svv79WdT0Da42kWt_hQ0
Checklist:
- Introduction to Kickstart Your Elixir Journey
- Part 1: Project Design
- Part 2: Setting Up and User Authentication
- Part 3: Generating Our Schemas
- Part 4: Crafting the Navigation Bar
- Part 5: Animating Dropdown Menu with JS.toggle
- Part 5b: Collapsing Dropdown Menu (when click outside menu)
- Part 6: Creating the Footer
- Part 7: Crafting the 'Create Gist' View
- Part 8: Form Creation with LiveView and HEEx
- Part 9: Form Validation and Database Persistence
- Part 10: Adding Line Count Feature
- Part 11: Sync Scrolling Between Textareas
$ mix phx.new elixir_gist --binary-id
$ mix phx.gen.auth Accounts User users
$ mix deps.get
$ mix ecto.setup
$ mix phx.server
Command:
$ mix phx.gen.context <Context> <Schema> <table> <fields>
Read more about context: https://hexdocs.pm/phoenix/Mix.Tasks.Phx.Gen.Context.html
Contexts: The context is an Elixir module that serves as an API boundary for the given resource.
Schema: The schema is responsible for mapping the database fields into an Elixir struct.
Read more about schema: https://hexdocs.pm/ecto/Ecto.Schema.html
-> Change relationship in schema.
# Table gists
$ mix phx.gen.context Gists Gist gists user_id:references:users name:string description:text markup_text:text
$ mix phx.gen.context Gists SavedGist saved_gists user_id:references:users gist_id:references:gists
$ mix phx.gen.context Comments Comment comments user_id:references:users gist_id:references:gists markup_text:text
$ mix ecto.migrate