Giter VIP home page Giter VIP logo

feeb's Introduction

Feeb 🥩

Fibonacci REST JSON API

API

  1. GET /:n

An endpoint that returns the value from the Fibonacci sequence for a given number.

Params:

  • :n (non negative integer) - the requested Nth Fibonacci number

Request: curl http://localhost:4001/6

Response: {"result": 8}

  1. GET /list/:n?next_key=:k&size=:s

An endpoint that returns a list of numbers and the corresponding values from the Fibonacci sequence from 1 to N with support for pagination. Page size should be parameterized with a default of 100.

Params:

  • :n (non negative integer) - the requested Nth Fibonacci number
  • :k (non negative integer) - optional (default: 0) value of the next Nth number for pagination
  • :s (non negative integer) - optional (default: 100) value of the number of results per one page

Request: curl http://localhost:4001/list/42?next_key=2&size=3

Response: {"result": [1, 2, 3], "next_key": 5}

  1. PUT /blacklist/:n

An endpoint to blacklist a number to permanently stop it from being shown in Fibonacci results when requested. The blacklisted numbers should persist in application state.

  • :n (non negative integer) - the Nth Fibonacci number

Request: curl PUT http://localhost:4001/blacklist/42

Response: 204 No Content

  1. DELETE /blacklist/:n

An endpoint to remove a number from the blacklist.

  • :n (non negative integer) - the Nth Fibonacci number

Request: curl DELETE http://localhost:4001/blacklist/42

Response: 204 No Content

Tests

To run tests, make sure elixir is installed and run

make tests

feeb's People

Contributors

neoascetic avatar

Watchers

 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.