Taking Goldcrest for a spin
In this section, we will use what we’ve built, and the features we’ve added to Goldcrest up to this point, to build an example web application. This application will support routes that respond with both HTML and JSON. We will also test out the new feature added to Goldcrest.View
, which allows us to call a helper function inside an HTML template.
Let’s start by creating a new mix project and adding goldcrest
to its mix
dependencies:
mix.exs
$ mix new tasks_web --sup .. $ cd tasks_web defmodule TasksWeb.MixProject do # .. # Run "mix help deps" to learn about dependencies. defp deps do [ {:goldcrest, path: "../goldcrest"} ] end end
Running mix deps.get
should resolve hex
dependencies for the tasks_web
app.
Now, let’s add a router module with a default 404
handler....