axios-request-response-time
v1.0.3
Published
Axios plugin to measure the actual time from request and response
Downloads
227
Readme
axios-request-response-time
Axios plugin to measure the actual time from request and response
Installation
You can install this plugin using NPM
> npm i axios-request-response-time
Basic Usage
The example below will add timing data to the request response cycle.
const axios = require('axios');
const axiosTime = require('axios-request-response-time');
axiosTime(axios);
try {
const response = await axios.get('/https://api.openweathermap.org/data/2.5/weather');
console.log(response.timings)
} catch(err) {
}
response.timings object example:
{
"timingEnd": 1599035291441, // Timestamp of the start of the request (in Unix Epoch milliseconds).
"timingStart": 1599035289182, // Timestamp when the response ended (in Unix Epoch milliseconds).
"elapsedTime": 2259 // elapsedTime*1000 = milliseconds time.
}