Chapter 15. Using Phoenix
While it’s great to use Elixir from the command line, sometimes you’ll want to expose your work to the Web as well. The Phoenix framework offers an Elixir-based toolkit, somewhat like Ruby on Rails, for building web applications. Phoenix is designed for robustness and scalability, building on macros, OTP, and Erlang’s Cowboy server. It wraps those powerful features, though, so you can get started building simple things without mastering those details.
Once you have Elixir itself installed, installing just Phoenix isn’t difficult. Installing everything that Phoenix might want, including PostgreSQL and Node.js is more than this introduction can cover, but you can do (at least sort of) useful things with only Phoenix.
To get started, install Phoenix from mix:
mix archive.install https://github.com/phoenixframework/archives/raw/master/ phoenix_new.ez Are you sure you want to install archive "https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez"? [Yn] y * creating .mix/archives/phoenix_new
Once you’ve installed Phoenix, you can have it build a minimalist application. The
--no-brunch directive turns off Phoenix’s support for managing assets, which requires you to install Node.
--no-ecto turns off the object relational mapping (ORM) that expects you to have installed PostgreSQL.
$ mix phoenix.new fall --no-brunch --no-ecto * creating web/config/config.exs * creating web/config/dev.exs ... * creating web/web/views/layout_view.ex ...