

If your screen looks like the image above, congratulations! You now have a working Phoenix application. If we point our favorite web browser at we should see the Phoenix Framework welcome page. Fetch and install dependencies? nīy default, Phoenix accepts requests on port 4000. If we choose not to have Phoenix install our dependencies when we generate a new application, the mix phx.new task will prompt us to take the necessary steps when we do want to install them. Access HelloWeb.Endpoint at build finished, watching for changes. Go ahead with the installation as Rebar is used to build Erlang packages.Īnd finally, we'll start the Phoenix server: $ mix phx.server Note: if this is the first time you are running this command, Phoenix may also ask to install Rebar. In case the database could not be created, see the guides for the mix ecto.create for general troubleshooting. The database for Hello.Repo has been created Now we'll create our database: $ mix ecto.create

First, we'll cd into the hello/ directory we've just created: $ cd hello If that isn't the case, please see the Mix Tasks Guide to learn more about the mix ecto.create task. Phoenix assumes that our PostgreSQL database will have a postgres user account with the correct permissions and a password of "postgres". Once our dependencies are installed, the task will prompt us to change into our project directory and start our application. You can also run your app inside IEx (Interactive Elixir) as: Then configure your database in config/dev.exs and run: We are almost there! The following steps are missing: When it's done, it will ask us if we want it to install our dependencies for us. We can git init our repository, and immediately add and commit all that hasn't been marked ignored. Phoenix promotes the usage of git as version control software: among the generated files we find a. Phoenix generates the directory structure and all the files we will need for our application. To learn more about mix phx.new you can read the Mix Tasks Guide. If our application will not require this component we can skip this dependency by passing the -no-ecto flag to mix phx.new. Assuming that the name of our application is hello, let's run the following command: $ mix phx.new helloĪ note about Ecto: Ecto allows our Phoenix application to communicate with a data store, such as PostgreSQL, MySQL, and others. Phoenix will accept either an absolute or relative path for the directory of our new project. We can run mix phx.new from any directory in order to bootstrap our Phoenix application. By installing any necessary dependencies beforehand, we'll be able to get our application up and running smoothly. Let's get a Phoenix application up and running as quickly as possible.īefore we begin, please take a minute to read the Installation Guide.
