Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] timing only mode #6

Closed
defunctzombie opened this issue Dec 8, 2014 · 3 comments
Closed

[RFC] timing only mode #6

defunctzombie opened this issue Dec 8, 2014 · 3 comments
Assignees

Comments

@defunctzombie
Copy link

I want to use this module to calculate the response times, but don't want to send back a header. Instead, I want to provide a callback that will be called when the response time is calculated so I can then store this in a stats db/tracker.

Thoughts?

@dougwilson dougwilson self-assigned this Dec 8, 2014
@dougwilson
Copy link
Contributor

Ok, so I'm thinking of just making it accept a function over the options object all together. Basically what it does is makes the middleware constructor even more polymorphic. The first argument can be a function and it'll be invoked with the response time.

app.use(responseTime(function (req, res, time) {
  // do something
}))

@defunctzombie
Copy link
Author

👍

@dougwilson
Copy link
Contributor

Sorry for the time this spent in my backlog :) Published in 2.3.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants