I have a module in node that I use to pass a username and password.
This is how it works in prompt:
node main.js --username admin --password pass
I'm trying to execute it in my node server via browser with:
const bundle = require ('./js/main.js')("--username admin --password pass")
The require runs the app but args are not working. How to fix this?
You can access the arguments passed in nodejs by accessing process.argv variable.
for (let i = 0; i < process.argv.length; i++)
{
console.log(process.argv[i])
}