Home > Blockchain >  Node.JS - How to hide secrets such as cookie secrets?
Node.JS - How to hide secrets such as cookie secrets?

Time:11-03

I would like to avoid having secrets hard coded into my Node.JS application like this:

app.use(cookieParser('SECRETSECRETSECRET1!!!'));

How can I secrets in Node.JS?

CodePudding user response:

Keep them in your .env file.

Then you can use packages like dotenv to load them into your js code

  • Related