https://github.com/frpouly/fibonacci_api
An API to compute Fibonacci numbers and inverted Fibonacci numbers.
https://github.com/frpouly/fibonacci_api
api-rest fibonacci fibonacci-generator ruby sinatra
Last synced: 10 months ago
JSON representation
An API to compute Fibonacci numbers and inverted Fibonacci numbers.
- Host: GitHub
- URL: https://github.com/frpouly/fibonacci_api
- Owner: frpouly
- License: apache-2.0
- Created: 2020-12-11T21:37:07.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-03-16T07:31:16.000Z (about 3 years ago)
- Last Synced: 2025-05-24T22:33:50.050Z (about 1 year ago)
- Topics: api-rest, fibonacci, fibonacci-generator, ruby, sinatra
- Language: Ruby
- Homepage: https://fibo-api.herokuapp.com/
- Size: 138 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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 :
``` bash
bunlde install
rackup -p 3000 &
```
Afterthat, you can access to the routes :
``` bash
curl -i localhost:3000/api/v1/fibonacci/12
curl -i localhost:3000/api/v1/inverted_fibonacci/144
```
And the small index : [localhost:3000/](localhost:3000)
### Using Docker
```bash
docker-compose up -d
```
And then you should be able to access to the site :
``` bash
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/](https://fibo-api.herokuapp.com/)
## Tests
I also implemented basic unit tests, you can run them with
```bash
rake
```