The latter creates a blocking issue
Creating an HTTPS Server with Node.js
Nilesh Singh

To be precise, the former creates a blocking issue, as the event loop is blocked by file i/o.

Though, this should be read in on server start time, not for each request. Therefore it’s only about choosing which delay is better for you:

Wait with further code execution until the file is read (synchronous), or start your server in a callback that gets executed as soon as all the files are read (asynchronous).

Like what you read? Give Stephan S a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.