nodejs morgan包
新建app.js
var express = require('express') var logger = require('morgan') var app = express() app.use(logger('dev'))//输出格式 :method :url :status :response-time ms - :res[content-length](返回字符串的长度) app.get('/', function (req, res) { res.send('helloworld!') }) app.listen(3000,function(){ console.log('server is running at port 3000'); })
启动 app.js
node app.js
输出一下内容