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

Опубликовано: 04 Апрель 2024
на канале: 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...


Смотрите видео javascript - How do I pass command line arguments to a Node.js program and receive them? онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Code Samples 04 Апрель 2024, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 75 раз и оно понравилось 2 людям.