[Fixed] Get the number of Requests in Express

Issue

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

Solution

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

(*) Required, Your email will not be published