I have build an API with a single endpoint that performs a checkout action. The single endpoint takes a list of watch ids and returns the total price. In terms of programming language & framework, i am working with node.js and serverless.
Work with two consoles.
Open the first console and type in the following:
git clone https://github.com/Balou9/bcg-coding-challenge.git
cd bcg-coding-challenge/extermitators-api && npm i
Open the second console from the same directory and type in the following:
serverless offline start --noPrependStageInUrl
Send the sample curl request from the first console
chmod +x ./sample.sh && ./sample.sh
// "{\"price\":650}"
The unit tests are defined in test.js and will be runned any time a push is made to the repo.
Run tests locally in api directory:
npm test
- add cd to the pipeline
-
calcTotalPrice
to async - add and test statusCode edge cases