Skip to content

frpouly/fibonacci_API

Repository files navigation

fibonacci_API

Routes :

  • / : a tiny webpage where you will be able to interrogate the API
  • /api/v1/fibonacci/number : returns the result of Fibonacci(number)
  • /api/v1/inverted_fibonacci/number : returns an integer n so that n = Fibonacci(number) number is in the Fibonacci sequence

Running the service :

Locally with Rack

If you already have a Ruby environment and bundler gem, you can run the application locally with :

bunlde install
rackup -p 3000 &

Afterthat, you can access to the routes :

curl -i localhost:3000/api/v1/fibonacci/12
curl -i localhost:3000/api/v1/inverted_fibonacci/144

And the small index : localhost:3000/

Using Docker

docker-compose up -d

And then you should be able to access to the site :

curl -i localhost:3000/api/v1/fibonacci/12
curl -i localhost:3000/api/v1/inverted_fibonacci/144

Heroku

I deployed the API on Heroku, it available at the address : https://fibo-api.herokuapp.com/

Tests

I also implemented basic unit tests, you can run them with

rake