Giter Site home page Giter Site logo

fibonacci_api's Introduction

fibonacci_api

Requirements

  • fastapi 0.75.1
  • uvicorn 0.17.6

Setup project

Create a virtual environment
python3 -m venv fibonacci_api

Activate virtual environment
source fibonacci_api/bin/activate

Install dependencies
pip3 install -r requirements.txt or pip3 install fastapi==0.75.1 uvicorn==0.17.6

RUN server

We need to move into fibonacci_api directory and execute the follow command:
uvicorn main:app

API Doc

The API documentation is displayed visiting the following url:
http:127.0.0.1:8000/redoc

Endpoint

Test the API

For test the API, we need you make a request to http://127.0.0.1:8000/api/v1/fibonacci/{index} with a GET http method, followed of a index as documentation mentioned it.

Notes
  1. La seria de Fibonacci comienza con los dígito 0 y 1, se repite el 1 y los siguientes es la suma de los dos elementos anteriores 0, 1, 1, 2, 3, 5, 8, 13, 21 ...
  2. Puedo emplear una función recursiva que me permita obtener los primeros n elementos de la serie dado un número
  3. Si deseo obtener el valor correspondiente a un índice, necesito trabajar con listas, tuplas
  4. Podría utilizar funciones lambda?
  5. Me gustaría implementar fastAPI ya que implementa documentación de api automáticamente, no es una tecnología que domine pero sería bueno aprovecharla para este ejercicio.
  6. La creación de función de fibonacci debería de incluir una lista o comprenhension de listas
  7. Estuve investigando y puedo implementar lambda y reduce or map, de esa manera obtengo un iterable y puedo acceder a sus elementos a través de un índice, además, con reduce ya obtengo el acumulativo de los dos elementos anteriores en la serie.
  8. Decidí utilizar lambda y reduce
  9. La función funciona correctamente, ahora debo exponer la API para pasar un indice y obtener el valor de esa posición
  10. Para probar la API voy a usa Postman y el navegador Google Chrome
Test Ouput

fibonacci_api's People

Contributors

mariomtzjr avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.