Oracle Magazine, July/August 2017
Database Developer OPEN SOURCE application will run And because all JavaScript code shares the same thread its very important that no application code consume much time on the thread Enter asynchronous Node js code GETTING TO ASYNCHRONOUS Many languages have features that allow for asynchronous programming and JavaScript is particularly adept at this due to its event driven nature Lets get into some code examples that demonstrate the difference between synchronous code and asynchronous Node js code Heres that hello world you knew was coming ORACLE MAGAZINE JULY AUGUST 2017 53 console log hello console log world Add those lines to a file named sync js To run this script with Node js open a terminal change directories to where sync js was created and run the following command node sync js hello world As you can see hello appeared first in the console followed by world completely synchronous So how can the code be made to run asynchronously The answer is to use one of the asynchronous APIs provided by a built in or third party
You must have JavaScript enabled to view digital editions.