如何停止 NodeJS 向控制台打印 GET 请求
How to stop NodeJS printing GET requests to the console
NodeJs 正在将每个 GET 请求(.js 文件、.css 文件等)打印到控制台。
...
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 - -
...
有没有办法阻止 Node 将这些打印到控制台?
这是我的 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"
}
}
谢谢。
helmet
package that uses connect
包下面使用 debug
包记录每个 http 请求,只需删除此行
var helmet = require('helmet');
app.use(helmet());
并使用 npm uninstall helmet --save
卸载它
也是用morgan来记录的,也看看https://github.com/expressjs/morgan
发现是 morgan
模块在执行此操作。
我有 app.user(logger('dev'))
;
NodeJs 正在将每个 GET 请求(.js 文件、.css 文件等)打印到控制台。
...
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 - -
...
有没有办法阻止 Node 将这些打印到控制台?
这是我的 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"
}
}
谢谢。
helmet
package that uses connect
包下面使用 debug
包记录每个 http 请求,只需删除此行
var helmet = require('helmet');
app.use(helmet());
并使用 npm uninstall helmet --save
也是用morgan来记录的,也看看https://github.com/expressjs/morgan
发现是 morgan
模块在执行此操作。
我有 app.user(logger('dev'))
;