I have a REST API which I’ve crated using iron-router’s server side routes. It’s a very basic service: I have a rest endpoint /api/:mobileNumber
which a third-party service hits with a mobile number. I check if the mobile number is registered with my app, and send them a SMS using another third party service.
The problem is, when there are 2 simultaneous requests, say from phone number NNN and number MMM, one of them fails saying ‘Server error’, and other one gets messed up, such that the MMM user sees a 500 Error
, and NNN sees the request getting successful. But, sms gets sent to MMM user instead.
Shouldn’t the clashing requests be something handled by router itself? Or do I need to build some sort of queuing myself?