JSON API web service example
JavaScript Elixir
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
config
docs
lib
priv
test
web
.gitignore
LICENSE
Procfile
README.md
mix.exs
mix.lock

README.md

Phoenix JSON API Example

Simple JSON API example for json-api-normalizer show case. Mentioned in [HabraHabr article](http://habr.ru ToDo)

This application is available on Heroku — https://phoenix-json-api-example.herokuapp.com/api/test

Endpoints

The only supported endpoint so far is /test, which returns bunch of test data.

Data Objects

Phoenix JSON API Example Data Object Diagram

Installation

To start your Phoenix app:

  • Install dependencies with mix deps.get
  • Create and migrate your database with mix ecto.create && mix ecto.migrate
  • Seed the test data with mix run priv/repo/seeds.exs
  • Start Phoenix endpoint with mix phoenix.server

Now you can visit localhost:4000 from your browser.

Heroku Deployment

This project is heroku deployment ready:

  • Fork this repo and setup integration with heroku
  • Setup elixir buildpack for heroku with heroku buildpacks:set https://github.com/HashNuke/heroku-buildpack-elixir
  • Create PostgreSQL database with heroku addons:create heroku-postgresql:hobby-dev
  • Update PostgreSQL database pool size with heroku config:set POOL_SIZE=18
  • Set the secret key value with heroku config:set SECRET_KEY_BASE="xvafzY4y01jYuzLm3ecJqo008dVnU3CN4f+MamNd1Zue4pXvfvUjbiXT8akaIF53"
  • Run the database migrations with heroku run "POOL_SIZE=2 mix ecto.migrate"
  • Finally, seed the test data with heroku run "POOL_SIZE=2 mix run priv/repo/seeds.exs"

Now you can visit https://__YOUR__APP__/api/test from your browser.

License

MIT (c) Yury Dymov