How can I have our node.js application halt/block, waiting on stdin before running the rest of the code? I have:
var readline = require('readline');
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
var ECRYPTION_KEY;
rl.question('Provide the global encryption key:', function(encyrptionKey) {
ECRYPTION_KEY = encyrptionKey;
rl.close();
});
var https = require('https');
https.createServer({ ... });
console.log("https server running...");
Right now, I see Provide the global encryption key: and also https server running.. immediately. I.E. does not block and wait on stdin before creating the https server.
createServerfunction inside the callback for thequestion()function