A
A
Andre19972022-01-25 17:53:30
Node.js
Andre1997, 2022-01-25 17:53:30

How to use process via env without modules and json settings?

There is an example on the site.

import { env } from 'process';
env.TEST = 1;
console.log(env.test);

But I don't have modules and I don't have jason, where can I configure modularity
How do I access process with require?
To run the code
env.text = '123'
console.log(env.text)


And when starting from the console, I could specify the value for textand it already gave out not 123, but my text

The task that I'm trying to solve is to connect env and through the console to be able to change it during the call

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rag'n' Code Man, 2022-01-25
@Andre1997

Create an environment variable on your system and access it via process.env.VAR_NAME.
If you want to pass parameters when the application starts, then read about process.argv.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question