Skip to content

An API server implemented in Elixir and Phoenix that returns statistical data from a set of dummy restaurants.

Notifications You must be signed in to change notification settings

pablodavila95/melp_intellimetrica

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MelpIntellimetrica

Heroku Deployment

  • Requires Elixir buildpack - heroku buildpacks:set https://github.com/HashNuke/heroku-buildpack-elixir
  • Set the pool size so Phoenix doesn't overload Heroku -heroku config:set POOL_SIZE=18
  • Generate secret with mix phx.gen.secret and run - heroku config:set SECRET_KEY_BASE="$$$KEY$$$"
  • After pushing to Heroku run the following - heroku run "POOL_SIZE=2 mix ecto.migrate"

The included Procfile automatically tells Heroku to run mix phx.server

Endpoints

  • /restaurants/statistics - takes latitude, longitude and radius in GET request. Example: https://intellimetrica-test-pablo.herokuapp.com/restaurants/statistics?latitude=19.4400570537131&longitude=-99.1270470974249&radius=10 Returns a JSON containing the count, average rating and std. deviation of restaurants in a given radius.

  • /restaurants/byCity - takes city in a GET request. Example: https://intellimetrica-test-pablo.herokuapp.com/restaurants/byCity?city=Querétaro Returns a JSON containing all restaurants in a given city.

  • /restaurants/byState - takes state in a GET request. Example: https://intellimetrica-test-pablo.herokuapp.com/restaurants/byCity?state=Jalisco Returns a JSON containing all restaurants in a given state.

  • /restaurants/byRating - takes rating in a GET request. Example: https://intellimetrica-test-pablo.herokuapp.com/restaurants/byCity?rating=3 Returns a JSON containing all restaurants with a given rating.

  • /restaurants/rating - takes no parameters. Example: https://intellimetrica-test-pablo.herokuapp.com/restaurants/rating Returns a JSON with the percentage of restaurants with all ratings (0 - 5).

  • /restaurants/create - takes the parameters to create a restaurant (can be seen in Postman). Returns a created_at timestamp.

  • /restaurants/delete - takes an id. Deletes a restaurant by id and returns a deleted_at timestamp.

About

An API server implemented in Elixir and Phoenix that returns statistical data from a set of dummy restaurants.

Resources

Stars

Watchers

Forks

Languages