calculating time taken by the http request using express node.js

I am logging the every server call details in plaintext file using node.js and express in the extended log format, For this i need to find out the length of time that the action took(http get or post).

How to find out the time taken for the particular request?

Any idea will be greatful.

If you are using the express.logger() middleware, you can easily add a :response-time token. See http://www.senchalabs.org/connect/middleware-logger.html for documentation.

Otherwise, use the responseTime middleware and do something like

 console.log(res.getHeader("X-Response-Time")) 

in your own middleware.