Antoine Sauvinet — Technology Executive & Entrepreneur
FR | EN
Blog Resume Contact

[Node.js] Build a clean process manager

In this article, I’ll demonstrate how to buid a simple and maintainable process manager for Node.js, leveraging its Event Loop. The main idea is have a core processor that will be able to run a serie of tasks, in a synchronous way. As you may know, Javascript is by essence an asynchronous language. Let take simple example : 1 2 3 4 5 6 7 8 function CrawlingAWebPageAndGetLinks(){ // do the stuff the method pretend; } (function program(){ var result = CrawlingAWebPageAndGetLinks(); console.log(result); })(); As the execution flow is asynchroneous, the result variable will not be valued before the crawling method ends, and the usage of the variable will occurs before its valuation The standard solution in javascript to handle this issue is to use a callback method : ...

August 30, 2015 · 4 min · 840 words · oinant