Good Day
I have a weird requirement and I wouldn't mind picking some brains out there.
Our rest api has a route to create an Action. Actions have many different types.
Each action routes through a couple pieces of middleware to execute different logic.
There is an order of certain types of actions and an "open" action cannot happen until a 'receipt' action is created.
We have one scenario where an 'open' action request can be sent before a 'receipt" action has been created and we want to modify the request to force a 'receipt' action to be saved before the open and preform a second request back to the api to route through the same endpoint to create the 'open' action.
My initial thought is accept the 'open' action and change the properties to make it a 'receipt' action, allow it to continue saving etc as a 'receipt', then post the same data back to the same url and this time when it checks for a receipt it finds the 'receipt' action and permits the 'open' action to be saved.
I just want to send the request and not wait for the server response. Once sent, i would like that connection to close so there are no 'Error: socket hang up'.
Is there a better way to handle this? Im just using a
request.post('same url').form(req.body);
thanks
JB