Phoenix

Related

Installation

$ mix archive.install hex phx_new [version]
$ mix phx.new —version
$ mix help phx.new
$ mix archive.uninstall phx_new

Creating a Project

$ mix phx.new my_project

Development Commands

  • Dev server: mix phx.server
  • Console: iex -S mix
  • mix help phx.[subtask]
  • mix phx - list all commands
    • mix phx.routes
    • mix phx.server
    • mix phx.gen.[auth,json,live,schema]
  • mix ecto
    • mix ecto.create
    • mix ecto.drop
    • mix ecto.gen.migration
    • mix ecto.migrate
    • mix ecto.rollback
  • mix run priv/repo/seeds.exs

Generators

mix phx.gen.[json,live,schema] Context Schema tableplural \
  title:string description:text views:integer \
  status:enum:pending:open:closed parent_id:references:parent

https://phoenix.hexdocs.pm/Mix.Tasks.Phx.Gen.Schema.html#module-attributes

Development Environment