14 mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez
18 # Create a new project
23 # Start the application
27 Install Erlang, Elixir, Node.js, PostgreSQL first.
28 See: [Installation](https://hexdocs.pm/phoenix/installation.html) _(hexdocs.pm)_
30 ### Directory structure
58 See: [Adding pages](https://hexdocs.pm/phoenix/adding_pages.html) _(hexdocs.pm)_
63 $ mix ecto.gen.migration update_posts_table
64 creating priv/repo/migrations/20160602085927_update_posts_table.exs
69 create table(:documents) do
71 add :title, :string, default: "Hello"
74 add :price, :float, precision: 10, scale: 2
79 [Ecto migrations cheatsheet](./phoenix-migrations)
85 get "/", PageController, :index
87 resources "/users", UserController do
88 resources "/posts", PostController
93 user_post_path(conn, :index, 17) # → /users/17/posts
94 user_post_path(conn, :show, 17, 12) # → /users/17/posts/12
97 [Phoenix routing cheatsheet](./phoenix-routing)
103 conn.host # → "example.com"
104 conn.method # → "GET"
105 conn.path_info # → ["posts", "1"]
106 conn.request_path # → "/posts/1"
112 |> html("<html><head>···")
113 |> json(%{ message: "Hello" })
115 |> redirect(to: "/foo")
116 |> render("index.html")
117 |> render("index.html", hello: "world")
118 |> render(MyApp.ErrorView, "404.html")
121 [Phoenix conn cheatsheet](./phoenix-conn)
130 profiles \ # table name
135 [Ecto cheatsheet](./phoenix-ecto)
140 - [Phoenix framework site](http://phoenixframework.org/) _(phoenixframework.org)_
141 - [Phoenix: getting started](https://hexdocs.pm/phoenix/overview.html) _(hexdocs.pm)_