madu
madu

Reputation: 5450

How to stop NodeJS printing GET requests to the console

NodeJs is printing each GET request (.js files, .css files, etc.) to the console.

...   
    GET /plugins/jquery.parallax-1.1.3.js 304 0.652 ms - -
    GET /plugins/jquery.validate.js 304 0.434 ms - -
    GET /plugins/vide/jquery.vide.js 304 0.910 ms - -
    GET /plugins/owl-carousel/owl.carousel.js 304 0.700 ms - -
...

Is there a way to stop Node printing these to the console?

Here is my package.json:

{
  "name": "ExPlatform",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "start": "node ./bin/www"
  },
  "dependencies": {
    "bcrypt-nodejs": "0.0.3",
    "body-parser": "~1.12.0",
    "connect-flash": "^0.1.1",
    "cookie-parser": "~1.3.4",
    "debug": "~2.1.1",
    "ejs": "~2.3.1",
    "express": "~4.12.2",
    "express-session": "^1.13.0",
    "fs": "0.0.2",
    "gm": "^1.21.1",
    "imagemagick": "^0.1.3",
    "mongoose": "^4.3.7",
    "mongoose-crate": "^1.0.10",
    "mongoose-crate-localfs": "^1.1.1",
    "morgan": "~1.5.1",
    "multer": "^1.1.0",
    "passport": "^0.3.2",
    "passport-local": "^1.0.0",
    "serve-favicon": "~2.2.0",
    "jsonfile": "^2.3.0",
    "nodemailer": "^2.4.2",
    "fast-csv": "^2.0.0",
    "fluent-logger": "^1.1.1"
  }
}

Thank you.

Upvotes: 0

Views: 1193

Answers (2)

Medet Tleukabiluly
Medet Tleukabiluly

Reputation: 11930

It's helmet package that uses connect package underneath which uses debug package which logs every http request, just remove this line

var helmet = require('helmet');
app.use(helmet());

And uninstall it using npm uninstall helmet --save

Also morgan is used to log, check it out too https://github.com/expressjs/morgan

Upvotes: 1

madu
madu

Reputation: 5450

Found it was the morgan module that was doing this. I had app.user(logger('dev'));

Upvotes: 4

Related Questions