Slackir

Now that you have all of your development tools and dependencies installed you can start working on developing your first application Slackir! It's like Slack but in Elixir. Slackir will make the most of phoenix’s web sockets and evented programming. You will see different types of code snippets through out these docs, if they beign with a "$"" then they are terminal commands and you do not need to copy the $ into the terminal.

Setting up Our App

The first thing that we want to do is create our Phoenix app. We do this with the following command and we'll pass in "slackir" as the name of our app.

$ mix phx.new slackir

The next step is to move into our newly created application. To do that run the following command to change the directory.

$ cd slackir

Now we can install our applications dependencies by running

$ npm install

and we can create our database by running

$ mix ecto.create

To start the server you will need to run

$ mix phx.server

If server doesn't start, probably you need to add :plug_cowboy dependency in mix.exs file.

Add this {:plug_cowboy, "~> 1.0"} in the bottom list of libraries. The list should look like that:

defp deps do
  [
    {:phoenix, "~> 1.3.4"},
    {:phoenix_pubsub, "~> 1.0"},
    {:phoenix_ecto, "~> 3.2"},
    {:postgrex, ">= 0.0.0"},
    {:phoenix_html, "~> 2.10"},
    {:phoenix_live_reload, "~> 1.0", only: :dev},
    {:gettext, "~> 0.11"},
    {:cowboy, "~> 1.0"},
    {:plug_cowboy, "~> 1.0"}
  ]
end

In order to install newly added dependency run

$ mix deps.get

Then again run serwer

$ mix phx.start

and go to http://127.0.0.1:4000 to view your new application!