• Home
  • About
    • Sh3yk0 Portfolio photo

      Sh3yk0 Portfolio

      An aspiring developer who loves to take on new projects that challenges his analytical and technological capacities

    • Learn More
    • LinkedIn
    • Github
  • Posts
    • All Posts
    • All Tags
  • Projects

Fibonacci API

30 Nov 2022

Reading time ~1 minute


Logo

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
  1. About The Project Solution
    • Built With
  2. Getting Started
    • Prerequisites
    • Installation
  3. Usage

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

  1. Clone the repo
    git clone https://github.com/SheykoWk/Fibonacci-API.git
    cd Fibonacci-API
    
  2. Install NPM packages
    npm install
    
  3. Generate your .env file
    cp .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
    
  1. You can make requests to the next url
    • GET /api/v1/fibonacci/ type: application/json response:
      {
       "error": false,
       "status": 200,
       "data": <Fibonacci Value>
      }
      


EnglishBackendDocumentacionNodeExpress Share Tweet