![]() Postgres, username: "auth0", password: "phoenixelixir", database: "countdown". (They will both be set to “postgres” by default.). exs, and edit the username and password near the bottom of the file. We need to be able to store the events we are going to count down to.īefore we can start adding our data, we need to set up the database. Now we can take a look our app by visiting It should look something like. Warning: String.strip/1 is deprecated, use im/1 Running CountdownWeb.Endpoint with Cowboy using Compiling 13 files (.ex ). It shows us the compilation including any warnings or errors including deprecations or unused variables. So let's change directory and check we can run the application. Once it's finished it will give you some helpful info to check that it's all working, running your application, and even how to interact with your app inside IEx (Interactive Elixir).Ĭheck out the following to learn more about debugging techniques in Elixir using IEx. * running cd assets & npm install & node node_modules/brunch/bin/brunch build It will fetch and compile our dependencies. If we don’t want to use Brunch.io at all, we can simply pass -no-brunch to mix phx.new. If we say “no” at that point, and if we don’t install those dependencies later with npm install, our application will raise errors when we try to start it, and our assets may not load properly. Phoenix will prompt us to install them at the end of the mix phx.new task. Brunch.io’s dependencies are installed via the node package manager, not mix. Phoenix uses Brunch.io for asset management. When prompted, fetch and install dependencies. * creating countdown/assets/static/favicon.ico Everything you need, really! * creating countdown/config/config.exs It will now generate a skeleton application with config, controllers, routing, etc. Now we can create a new application with the Phoenix framework. If you choose to use another database provider, make sure you edit the configuration appropriately. To follow this guide fully, make sure you also have PostgreSQL and npm installed. Now we can install Phoenix v1.3.0: $ mix archive.install Other requirements Phoenix needs at least Elixir 1.4 and Erlang 18 or later, run: $ elixir -vĮrlang/OTP 19 Now use mix to install hex: $ mix local.hex Install Phoenix If you know Ruby well, Mix is Rake, Bundler, and RubyGems combined. Mix is a build tool that provides tasks for creating, compiling, and testing Elixir projects, managing its dependencies, and more. ![]() Next, we run a mix command to install the Hex package manager. So, I thought, why not build an application where I can see countdowns to my favorite events?įollow the Elixir language install guide here: With holiday season fast approaching and a growing family, we're counting down the days when we can sit at home, in front of our (fake) fireplace and open some presents! :) It also has some interesting new twists like channels for implementing realtime features and pre-compiled templates for blazing speed. The Phoenix framework provides the best of both worlds: high developer productivity and high application performance. Phoenix is an MVC framework written in Elixir and will be welcoming and comfortable to use for anyone familiar with Rails or Django. "If your Elixir app compiles, it's practically deployable already!" If your Elixir app compiles, it's practically deployable already and the how-to guides come ready to talk you through getting it online with Heroku. You can be up and running almost immediately. Its got a super small footprint and is surprisingly robust. Elixir builds on Erlang and leverages the Erlang VM. My brain didn't have to work too hard to build something practical and fun. ![]() Fortunately for me, Elixir (like PHP) is a dynamically typed language with lots of helpful documentation. I've missed plenty of cool languages whilst playing with PHP-and the Elixir language is no exception. Personally, I've been stuck under a rock as a developer. The final code can be found at the auth0-elixir-countdown GitHub repo. Let's build an easy-to-use application that manages upcoming events, built with the Phoenix Framework and authenticated with Auth0. The Phoenix framework for Elixir apps is genuinely exciting to use. If your app compiles, it's already deployable. TL DR: The Elixir language is dynamically typed with lots of helpful documentation.
0 Comments
Leave a Reply. |