Fibonacci API
Rest API that accepts a number, n, as input and returns the number in the n position on Fibonacci sequence.
Table of Contents
About The Project
I’d started creating all the testing for my API, making unit and integration testing for the generate Fibonacci function and for the requests My first option was to make a recursive function but it takes so much time and has more algorithm complexity, so I decided to make it save all the values in an array to make it more fast and optimized I start with error management, so the different input cases are the next ones: - Receive NaN values - Receive Negative values So if I make the second error management I can validate both errors
Built With
This section should list any major frameworks/libraries used to bootstrap your project. Leave any add-ons/plugins for the acknowledgements section. Here are a few examples.
Getting Started
How you can use this project locally?
Prerequisites
This a is project made with JavaScript, so the first thing that you need is the latest npm version.
- npm
npm install npm@latest -g
Installation
- Clone the repo
git clone https://github.com/SheykoWk/Fibonacci-API.git cd Fibonacci-API
- Install NPM packages
npm install
- Generate your
.env
filecp .env.example .env
Usage
- To deploy your app in a dev environment
npm run dev
- To deploy your app in a production environment
npm start
- To run the tests
npm run test
- You can make requests to the next url
- GET /api/v1/fibonacci/
type: application/json response: { "error": false, "status": 200, "data": <Fibonacci Value> }
- GET /api/v1/fibonacci/