Get the number of Requests in Express

I would like to know if is there any way of getting the total number of request in a certain path with Expressjs?

Answer

Why not to count it by yourself?

let pingCount = 0;
app.get('/ping',(req, res) => {
  pingCount++;
  res.send(`ping world for ${pingCount} times`);
});

Leave a Reply

Your email address will not be published. Required fields are marked *