If there are two POST /match
requests, second request will wait until the first request is completed. However, if your post handler updates any global variables or object (e.g. cache), that change will be visible to other requests.
In your case randomPin.generate()
will not have a race condition problem as there is no such thing as simultaneous execution in Node.js.
You can read more on that here: Single threaded and Event Loop in Node.js