I would like to add an admin user to my node application via CLI. I created a file admin.js. This file looks like:
console.log('start');
myPromisse.then().catch(); // This promise add admin to mongodb
console.log('end');
I make node admin
and it works ... almost :D
Admin is not added because my script is not waiting for the promise. What is the best practice to handle this problem?