mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-02 14:50:54 -05:00
35 lines
682 B
CoffeeScript
35 lines
682 B
CoffeeScript
|
express = require("express")
|
||
|
app = express()
|
||
|
bodyParser = require('body-parser')
|
||
|
|
||
|
app.use(bodyParser.json())
|
||
|
|
||
|
module.exports = MockV1Api =
|
||
|
|
||
|
exportId: null
|
||
|
|
||
|
exportParams: null
|
||
|
|
||
|
setExportId: (id) ->
|
||
|
@exportId = id
|
||
|
|
||
|
getLastExportParams: () ->
|
||
|
@exportParams
|
||
|
|
||
|
clearExportParams: () ->
|
||
|
@exportParams = null
|
||
|
|
||
|
run: () ->
|
||
|
app.post "/api/v1/sharelatex/exports", (req, res, next) =>
|
||
|
#{project, version, pathname}
|
||
|
@exportParams = Object.assign({}, req.body)
|
||
|
res.json exportId: @exportId
|
||
|
|
||
|
app.listen 5000, (error) ->
|
||
|
throw error if error?
|
||
|
.on "error", (error) ->
|
||
|
console.error "error starting MockOverleafAPI:", error.message
|
||
|
process.exit(1)
|
||
|
|
||
|
MockV1Api.run()
|