A small example of using the Star Wars API to list all of the starships and their pilots that have appeared in the Star Wars film canon.
Find a file
2020-12-21 23:28:32 -05:00
config Initial commit. 2020-12-21 23:28:32 -05:00
lib Initial commit. 2020-12-21 23:28:32 -05:00
test Initial commit. 2020-12-21 23:28:32 -05:00
.formatter.exs Initial commit. 2020-12-21 23:28:32 -05:00
.gitignore Initial commit. 2020-12-21 23:28:32 -05:00
default.nix Initial commit. 2020-12-21 23:28:32 -05:00
docker.nix Initial commit. 2020-12-21 23:28:32 -05:00
Dockerfile Initial commit. 2020-12-21 23:28:32 -05:00
mix.exs Initial commit. 2020-12-21 23:28:32 -05:00
mix.lock Initial commit. 2020-12-21 23:28:32 -05:00
README.md Initial commit. 2020-12-21 23:28:32 -05:00
shell.nix Initial commit. 2020-12-21 23:28:32 -05:00

SwapiExample

A small example of using the Star Wars API to list all of the starships and their pilots that have appeared in the Star Wars film canon.

Installation

Nix (preferred)

nix-shell # Downloads Docker and Elixir, and then starts a new shell with them in your path.
export MIX_ENV=prod
mix deps.get
mix compile
nix-build docker.nix # This step builds the release and puts it in an image.
docker load <result
docker run swapi_example:latest

Elixir

Run the following commands:

export MIX_ENV=prod
mix deps.get
mix compile
mix release
_build/prod/rel/swapi_example/bin/swapi_example eval 'Application.ensure_all_started(:swapi_example); SwapiExample.run'

Docker

Run the following commands:

export MIX_ENV=prod
mix deps.get
mix compile
mix release
docker build -t swapi_example:latest .
docker run swapi_example:latest