Sunday, 12 August 2018

Validate JSON Stream in Express app

Hey!I am developing a nodejs app. In one microservice I have my csv parsers, in the other logic around DB.Everything was going fine, until I started to send really big files to be parsed, which later are being streamed (via request) to my DB handling service and block the event loop.After some profiling I have found out that express-validator middleware is the root of the problem: when fed with a really huge object it blocks the entire service, and its unable to respond immidiately to other requests.What I need to achieve is to make the validation process asynchronous, and the options I consider are:write custom middleware, which operates on Streams (quite problematic)find a way to make express-validator asynchronously and stop blocking the loopHas anyone came into such a problem? Thanks in advance, greetings

Submitted August 12, 2018 at 04:28PM by bablador

No comments:

Post a Comment