Skip to content

Commit

Permalink
add swagger docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Fredrik Jadebeck committed Mar 2, 2021
1 parent 6dc2c50 commit 0f53900
Show file tree
Hide file tree
Showing 8 changed files with 293 additions and 5 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,12 @@ docker build -t margss-image . && docker run -d -p 8080:8080 margss-image
and access at [localhost:8080](localhost:8080).



# Frontend
![Image of MARGSS frontend](https://github.com/modsim/margss/blob/main/images/frontend.png)

# API-Docs
REST-API docs are available from a running instance at [localhost:8080/api-docs](localhost:8080/api-docs).
![Image of MARGSS frontend](https://github.com/modsim/margss/blob/main/images/api_docs.png)


52 changes: 48 additions & 4 deletions backend/job/job.routes.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,57 @@
const jobs = require('./job.controllers')

module.exports = function(router) {
/**
* @route POST /api/job
* @returns {object} 200 - JSON object with ID of job created
*/
router.post('/job/', jobs.create);
router.post('/job/:name/', jobs.create);

/**
* @route POST /api/job/:name
* @param {string} name - name for new job
* @returns {object} 200 - JSON object with ID of job created
*/
router.post('/job/:name', jobs.create);

/**
* @route GET /api/job/:id
* @param {string} id - id of job
* @returns {object} 200 - JSON object with ID of job created
*/
router.get('/job/:id', jobs.findOne);
/**
* @route GET /api/job
* @param {string} id - id of job
* @returns {object} 200 - JSON object with list of jobs
*/

router.get('/job/', jobs.findAll);
router.delete('/job/:id', jobs.delete);

/**
* @route DELETE /api/job
* @returns {object} 200 - JSON object with list of deleted jobs
*/
router.delete('/job/', jobs.deleteAll);

/**
* @route DELETE /api/job/:id
* @returns {object} 200 - JSON object with id of deleted job
*/
router.delete('/job/:id', jobs.delete);

/**
* @route GET /api/job/:id/model
* @param {string} id - job-id
* @returns {object} 200 - File download of rounded model
*/
router.get('/job/:id/model', jobs.downloadModel );

/**
* @brief Downloads samples
* @route GET /api/job/:id/samples
* @param {string} id - job-id
* @returns {object} 200 - File download of samples
*/
router.get('/job/:id/samples', jobs.downloadSamples);
router.get('/job/:id/mcmc_diagnostics',);
}
}
207 changes: 207 additions & 0 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@
"connect-busboy": "0.0.2",
"cors": "^2.8.5",
"express": "^4.17.1",
"express-swagger-generator": "^1.1.17",
"fs-extra": "^9.1.0",
"morgan": "^1.10.0",
"pm2": "^4.5.5",
"rimraf": "^3.0.2",
"swagger-ui-express": "^4.1.6",
"uuid-random": "^1.3.2"
}
},
"devDependencies": {}
}
Loading

0 comments on commit 0f53900

Please sign in to comment.