Giter Site home page Giter Site logo

fib_web's Introduction

Fib_Web

Provides a web service to calculate the first n Fibonacci numbers, using Python and Flask.

Prerequisites

Ensure your system has at least Python 2.7 installed. This was developed on a machine running 2.7.10. Assuming you have pip installed, pip install -r requirements.txt will install Flask 0.12.2. If you don't want your currently installed Python packages touched, consider setting up a virtualenv.

Running and Using

From the directory containing fib.py, run python fib.py &. This will start the service on your local machine, running on port 5000 in the background. To hit the endpoint, run curl -i localhost:5000/fib/<some positive integer>.

Integers less than 1, or any non integer values will return an error.

As an example, curl -i localhost:5000/fib/5 will return

$ curl -i localhost:5000/fib/5
127.0.0.1 - - [21/Dec/2017 21:54:07] "GET /fib/5 HTTP/1.1" 200 -
HTTP/1.0 200 OK
Content-Type: application/json
Content-Length: 60
Server: Werkzeug/0.13 Python/2.7.10
Date: Fri, 22 Dec 2017 05:54:07 GMT

{
  "result": [
    0,
    1,
    1,
    2,
    3
  ]
}

Remember, the process is running in your background, so make sure to bring it foward and kill it when you're finished.

Tests

To run the tests, run

python fib_tests.py

Note that fib_test.py must be in the same directory as fib.py

fib_web's People

Contributors

jaimguer avatar

Watchers

James Cloos 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.