Hi all! I have written a c# application that grabs data and creates a json file, this application Is called by my Express.js backend server which then reads the json file that was just created.The only problem is that when Express.js starts the .exe, the application takes a couple of seconds to execute so Express.js may grab an old version of the json file before a new one is created. So I have put a wait timer to make sure that that doesn't happen, however I do not like the wait timer and would much rather load the data when the executable finishes running.I have already tried checking to see if the json file exists then grabbing the json data from the file and deleting it for the next time the application is called, however given the asynchronous nature of Express things get messy very quickly and the file keeps failing to be deleted and failing to be fetched even when I order operations through middleware.Is there a way to send json data directly to Express.js from my c# application on execution? I know I can and have printed the json to the console that express runs in.Is there a way in Express to wait until an application has terminated? This would allow me to grab the correct json data without having to wait.Is there some other more easy way of doing all this?Any and all help is appreciated!
Submitted August 07, 2018 at 12:48AM by fluffyunicorn1
No comments:
Post a Comment