瀏覽代碼

New API entry that counts the number of pending tests

Gaël Métais 4 年之前
父節點
當前提交
b54eb0cca9
共有 1 個文件被更改,包括 5 次插入4 次删除
  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
     /*app.delete('/api/runs/:id', function(req, res) {