Added an optional callback argument for responseTime.
This callback will take one argument, the response time of the request.
All the old tests still pass. I added new tests to cover the new functionality.
Example Usage:
var express = require('express')
var responseTime = require('./response-time')
var app = express()
app.use(responseTime({digits: 5}, function(responseTime){
console.log("Response time:", responseTime)
}))
app.get('/', function (req, res) {
res.send('hello, world!')
})
app.listen(3000);
I added the callback as an argument, instead of a property in the options object, to keep in line with the pattern that node functions follow.
Added an optional callback argument for responseTime. This callback will take one argument, the response time of the request. All the old tests still pass. I added new tests to cover the new functionality.
Example Usage:
I added the callback as an argument, instead of a property in the options object, to keep in line with the pattern that node functions follow.