diff --git a/index.js b/index.js index 41a3cb5..9937f74 100644 --- a/index.js +++ b/index.js @@ -18,6 +18,21 @@ app.get('/', (req, res) => { res.send('Job handling server') }) +app.get('/jobs', (req, res) => { + let queued = Object.values(jobs['queued']); + let waiting = Object.values(jobs['waiting']); + let finished = Object.values(jobs['finished']); + + res.json( + { + 'jobs': { + 'queued': { 'count': queued.length, 'items': queued }, + 'waiting': { 'count': waiting.length, 'items': waiting }, + 'finished': { 'count': finished.length, 'items': finished }, + } + } + ); +}); app.listen(PORT, () => { console.log("Job Server running")