Upgrade severals examples from require to import.
JoseJPR opened this issue · 1 comments
JoseJPR commented
What do you think about change the import type of the modules from "require" to "import"? The new versions of NodeJS we can already work like this.
For example: https://github.com/lirantal/nodejs-cli-apps-best-practices#31-accept-input-as-stdin
import readline from "readline";
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
rl.question("What do you think of Node.js? ", answer => {
// TODO: Log the answer in a database
console.log(`Thank you for your valuable feedback: ${answer}`);
rl.close();
});
lirantal commented
I'd wait with this a little until this becomes more mainstream.
There are still many folks who use the conventional way of imports or older Node.js version branches.