2

this is my code :

const CrawlE = require('crawl-e/v0.5.2')
const debug = require('debug')


let crawlE = new CrawlE({
  cinemas: [
    {
      name: 'Kino Gmunden',
      address: 'Theatergasse 7, 4810 Gmunden',
      website: 'http://www.kino-gmunden.at/',
      phone: '0676 / 88 794 505'
    }
  ],

  showtimes: {
    url: 'https://www.daskino.at/programm/',
  }
  
})

crawlE.crawl()

i want to add an environment variable Debug=*, how can i set it and make this script run with it ?

0

1 Answer 1

2

If you are running your script from the command line just set the environment variable before running the script

// command line
DEBUG=* node index.js

// package.json
"scripts": {
  "test": "DEBUG=* node index.js"
},

// example vscode launch configuration
{
  "type": "node",
  "request": "launch",
  "env": { "DEBUG": "*" }, // -> this is the important part!
  "name": "Main",
  "program": "${workspaceFolder}/src/index.js",
  "skipFiles": [
    "${workspaceFolder}/node_modules/**/*.js",
    "<node_internals>/**/*.js"
  ]
},

Sign up to request clarification or add additional context in comments.

3 Comments

I am running it from the option in VS CODE!
where should i set it because i am so confused?
I've updated my answer to include package.json and vscode launch configuration.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.