MockTrackChangesApi.js 1.2 KB

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