/fizzbuzz-nodejs

Primary LanguageJavaScriptMIT LicenseMIT

FizzBuzz Solution

This is a web application in NodeJS that takes a collection of values.

  1. If the value is a multiple of 3, then output the word "Fizz"
  2. If the value is a multiple of 5, then output the word "Buzz"
  3. If the value is divisible by both 3 and 5, then output the word "FizzBuzz"
  4. At the end of the run, the program should display each division that was performed.

Requirements

Node v11.0.0 or higher.

Getting Started

To run this application, clone the repository and run npm run start. Next, open http://localhost:9000. Add, change, or remove values in the text area. Then click the FizzBuzz! button to process the values.

API

/fizzbuzz (POST)

Make a request with a valid JSON array body containing values to be processed. An array with FizzBuzz results will be returned.

Example Request Body

[
    "1",
    "3",
    "5",
    "",
    "15",
    "A",
    "23"
]

Example Response Body

[
  "Divided 1 by 3",
  "Divided 1 by 5",
  "Fizz",
  "Buzz",
  "Invalid Item",
  "FizzBuzz",
  "Invalid Item",
  "Divided 23 by 3",
  "Divided 23 by 5"
]