overleaf/services/track-changes/test/acceptance/coffee/helpers/MockDocStoreApi.coffee

28 lines
593 B
CoffeeScript
Raw Normal View History

2015-09-02 17:47:34 -04:00
express = require("express")
app = express()
module.exports = MockDocUpdaterApi =
docs: {}
getAllDoc: (project_id, callback = (error) ->) ->
callback null, @docs
run: () ->
app.get "/project/:project_id/doc", (req, res, next) =>
@getAllDoc req.params.project_id, (error, docs) ->
if error?
res.send 500
if !docs?
res.send 404
else
res.send JSON.stringify docs
app.listen 3016, (error) ->
throw error if error?
2017-10-20 10:24:58 -04:00
.on "error", (error) ->
console.error "error starting MockDocStoreApi:", error.message
process.exit(1)
2015-09-02 17:47:34 -04:00
MockDocUpdaterApi.run()