Open
Description
I am trying to run an express app through Visual Studio Code. I have a launch.json file with DEBUG defined like so:
"env": {
"DEBUG": "*"
}
Here is a trimmed down version of my app.js file where you can see the bolded debug line that doesn't output to the debug console (Test 2). Test 1 before it outputs as expected. If I run this from the command line passing DEBUG=* npm start
both lines show as expected.
var debug = require('debug')('app');
const express = require("express");
const cors = require("cors");
const bodyParser = require("body-parser");
const app = express();
const v1 = require('./routes/v1');
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
**debug("Test 1 that outputs!");**
app.use(function(req, res, next) {
console.error("THIS OUTPUTS");
**debug("Test 2 that doesn't output!!");**
console.log(`${req.method} request for '${req.url}' - ${JSON.stringify(req.body)}`);
next();
});
app.use(cors());
app.listen(3000);
console.log("Service running on port 3000");
module.exports = app;