The program presents simple express server with one endpoint supported by type-safe-errors
library.
Run instructions:
npm i
npm start
echo '{"productId":"123", "cvc": "456"}' | \
curl --header "Content-Type: application/json" \
--request POST \
--data-binary @- \
http://localhost:3000/payments
echo '{"productId":"123", "cvc": "999", "cardNumber": "123456789"}' | \
curl --header "Content-Type: application/json" \
--request POST \
--data-binary @- \
http://localhost:3000/payments
echo '{"productId":"404", "cvc": "456", "cardNumber": "123456789"}' | \
curl --header "Content-Type: application/json" \
--request POST \
--data-binary @- \
http://localhost:3000/payments
echo '{"productId":"123", "cvc": "456", "cardNumber": "123456789"}' | \
curl --header "Content-Type: application/json" \
--request POST \
--data-binary @- \
http://localhost:3000/payments