javascript - How do I pass command line arguments to a Node.js program and receive them?

Veröffentlicht am: 04 April 2024
auf dem Kanal: Code Samples
75
2

I have a web server written in Node.js and I would like to launch with a specific folder. I'm not sure how to access arguments in JavaScript. I'm running node like this:
$ node server.js folder

here server.js is my server code. Node.js help says this is possible:
$ node -h
Usage: node [options] script.js [arguments]

How would I access those arguments in JavaScript? Somehow I was not able to find this information on the web.
the node docs on handling command line args:: http://nodejs.org/docs/latest/api/pro...


Auf dieser Seite können Sie das Online-Video javascript - How do I pass command line arguments to a Node.js program and receive them? mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Code Samples 04 April 2024 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 75 Mal angesehen und es wurde von 2 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!