2014-02-26 10:56:52 -05:00
|
|
|
express = require("express")
|
|
|
|
app = express()
|
|
|
|
|
|
|
|
module.exports = MockTrackChangesApi =
|
|
|
|
flushDoc: (doc_id, callback = (error) ->) ->
|
|
|
|
callback()
|
|
|
|
|
|
|
|
run: () ->
|
2014-03-19 11:56:44 -04:00
|
|
|
app.post "/project/:project_id/doc/:doc_id/flush", (req, res, next) =>
|
2014-02-26 10:56:52 -05:00
|
|
|
@flushDoc req.params.doc_id, (error) ->
|
|
|
|
if error?
|
2020-03-19 11:39:57 -04:00
|
|
|
res.sendStatus 500
|
2014-02-26 10:56:52 -05:00
|
|
|
else
|
2020-03-19 11:39:57 -04:00
|
|
|
res.sendStatus 204
|
2014-02-26 10:56:52 -05:00
|
|
|
|
2014-10-07 07:31:16 -04:00
|
|
|
app.listen 3015, (error) ->
|
2014-02-26 10:56:52 -05:00
|
|
|
throw error if error?
|
2017-10-20 09:56:12 -04:00
|
|
|
.on "error", (error) ->
|
|
|
|
console.error "error starting MockTrackChangesApi:", error.message
|
|
|
|
process.exit(1)
|
2014-02-26 10:56:52 -05:00
|
|
|
|
|
|
|
MockTrackChangesApi.run()
|
|
|
|
|