node modules used:
- Express
- Mocha
- Chai
- Supertest
The server uses the port:8080
Installation:
npm install
Start Server:
npm start
To run test cases:
npm test
Route to calculate the LCM:
http://localhost:8080/lcm?values=[2,3,4]
Status codes:
200
if the array of values are natural numbersEx: [2,3,4]
.422
if the array of values are less than two natural numbersEx: [2]
.422
if the array of values are not natural numbersEx: [2,3,4.5,5.6]
.
Methods Used:
is_Natural
in the locationutils/isNatural.js
to check if the array of values are natural numbers.lcm
in the locationutils/find-lcm.js
to calculate the LCM of the natural numbers
Router location:
routes/get-lcm-route.js
Test cases location:
test/get-lcm-route-spec.js
test/isNatural-spec.js
test/find-lcm-spec.js