Skip to content

Commit 0f53900

Browse files
author
Fredrik Jadebeck
committed
add swagger docs
1 parent 6dc2c50 commit 0f53900

File tree

8 files changed

+293
-5
lines changed

8 files changed

+293
-5
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,12 @@ docker build -t margss-image . && docker run -d -p 8080:8080 margss-image
1212
and access at [localhost:8080](localhost:8080).
1313

1414

15+
16+
# Frontend
17+
![Image of MARGSS frontend](https://github.com/modsim/margss/blob/main/images/frontend.png)
18+
19+
# API-Docs
20+
REST-API docs are available from a running instance at [localhost:8080/api-docs](localhost:8080/api-docs).
21+
![Image of MARGSS frontend](https://github.com/modsim/margss/blob/main/images/api_docs.png)
22+
23+

backend/job/job.routes.js

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,57 @@
11
const jobs = require('./job.controllers')
22

33
module.exports = function(router) {
4+
/**
5+
* @route POST /api/job
6+
* @returns {object} 200 - JSON object with ID of job created
7+
*/
48
router.post('/job/', jobs.create);
5-
router.post('/job/:name/', jobs.create);
9+
10+
/**
11+
* @route POST /api/job/:name
12+
* @param {string} name - name for new job
13+
* @returns {object} 200 - JSON object with ID of job created
14+
*/
15+
router.post('/job/:name', jobs.create);
16+
17+
/**
18+
* @route GET /api/job/:id
19+
* @param {string} id - id of job
20+
* @returns {object} 200 - JSON object with ID of job created
21+
*/
622
router.get('/job/:id', jobs.findOne);
23+
/**
24+
* @route GET /api/job
25+
* @param {string} id - id of job
26+
* @returns {object} 200 - JSON object with list of jobs
27+
*/
28+
729
router.get('/job/', jobs.findAll);
8-
router.delete('/job/:id', jobs.delete);
30+
31+
/**
32+
* @route DELETE /api/job
33+
* @returns {object} 200 - JSON object with list of deleted jobs
34+
*/
935
router.delete('/job/', jobs.deleteAll);
36+
37+
/**
38+
* @route DELETE /api/job/:id
39+
* @returns {object} 200 - JSON object with id of deleted job
40+
*/
41+
router.delete('/job/:id', jobs.delete);
42+
43+
/**
44+
* @route GET /api/job/:id/model
45+
* @param {string} id - job-id
46+
* @returns {object} 200 - File download of rounded model
47+
*/
1048
router.get('/job/:id/model', jobs.downloadModel );
49+
50+
/**
51+
* @brief Downloads samples
52+
* @route GET /api/job/:id/samples
53+
* @param {string} id - job-id
54+
* @returns {object} 200 - File download of samples
55+
*/
1156
router.get('/job/:id/samples', jobs.downloadSamples);
12-
router.get('/job/:id/mcmc_diagnostics',);
13-
}
57+
}

backend/package-lock.json

Lines changed: 207 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

backend/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,13 @@
1515
"connect-busboy": "0.0.2",
1616
"cors": "^2.8.5",
1717
"express": "^4.17.1",
18+
"express-swagger-generator": "^1.1.17",
1819
"fs-extra": "^9.1.0",
1920
"morgan": "^1.10.0",
2021
"pm2": "^4.5.5",
2122
"rimraf": "^3.0.2",
23+
"swagger-ui-express": "^4.1.6",
2224
"uuid-random": "^1.3.2"
23-
}
25+
},
26+
"devDependencies": {}
2427
}

0 commit comments

Comments
 (0)