In my first blog of this series, I wrote about what is needed to start an Elixir project. In this blog, we will discuss what is needed to start a Phoenix application.
What is Phoenix?
Phoenix is a web development framework written in Elixir that implements the server-side Model View Controller(MVC) pattern.
To have a Phoenix application up and running, we will need to have the following installed:
the Elixir programming language, check Elixir 101 on how to install it.
a database - eg PostgreSQL
Once you have those setup, you will need to install the Phoenix application generator using the following command:
mix archive.install hex phx_new
Bootstrapping a Phoenix application
From your preferred directory, run the following command to start a new Phoenix application hello
mix phx.new hello
the Phoenix application generator generates the directory structure and all the files we will need for our application. Accept with Y
when prompted to install dependencies
Once done, move into your application directory by running:
cd hello
Now we will create our database by running:
mix ecto.create
to start the server run:
mix phx.server
the above command starts our server on port 4000 by default, to view go to http://localhost:4000