I have an Express API app like this.
var express = require('express');
const app = express();
app.get('/api', function(req, res) {
res.json({
text: 'my api!'
});
)
});
app.listen(8090, function () {
console.log('App listening on port 8090');
});
I'm wondering what is the most accurate way to measure the response time ?
The best solution that I found (thanks to this great tutorial), is to use morgan
:
npm install morgan
And then use it in my code like this:
const morgan = require('morgan');
app.use(morgan('dev'));