Pārlūkot izejas kodu

New API entry that counts the number of pending tests

Gaël Métais 4 gadi atpakaļ
vecāks
revīzija
b54eb0cca9
1 mainītis faili ar 5 papildinājumiem un 4 dzēšanām
  1. 5 4
      lib/server/controllers/apiController.js

+ 5 - 4
lib/server/controllers/apiController.js

@@ -224,10 +224,11 @@ var ApiController = function(app) {
         }
         }
     });
     });
 
 
-    // Retrieve the list of all runs
-    /*app.get('/api/runs', function(req, res) {
-        // NOT YET
-    });*/
+    // Counts all pending runs
+    app.get('/api/runs', function(req, res) {
+        res.setHeader('Content-Type', 'application/json');
+        res.send(JSON.stringify({pendingRuns: queue.length()}, null, 2));
+    });
 
 
     // Delete one run by id
     // Delete one run by id
     /*app.delete('/api/runs/:id', function(req, res) {
     /*app.delete('/api/runs/:id', function(req, res) {