MockProjectHistoryApi.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* eslint-disable
  2. camelcase,
  3. handle-callback-err,
  4. */
  5. // TODO: This file was created by bulk-decaffeinate.
  6. // Fix any style issues and re-enable lint.
  7. /*
  8. * decaffeinate suggestions:
  9. * DS102: Remove unnecessary code created because of implicit returns
  10. * DS207: Consider shorter variations of null checks
  11. * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
  12. */
  13. let MockProjectHistoryApi
  14. const express = require('express')
  15. const app = express()
  16. module.exports = MockProjectHistoryApi = {
  17. flushProject(doc_id, callback) {
  18. if (callback == null) {
  19. callback = function (error) {}
  20. }
  21. return callback()
  22. },
  23. run() {
  24. app.post('/project/:project_id/flush', (req, res, next) => {
  25. return this.flushProject(req.params.project_id, error => {
  26. if (error != null) {
  27. return res.sendStatus(500)
  28. } else {
  29. return res.sendStatus(204)
  30. }
  31. })
  32. })
  33. return app.listen(3054, error => {
  34. if (error != null) {
  35. throw error
  36. }
  37. })
  38. },
  39. }
  40. MockProjectHistoryApi.run()