mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-24 02:51:26 +00:00
add route parameters
This commit is contained in:
parent
9bc7594226
commit
8d14f8f7f0
1 changed files with 12 additions and 0 deletions
|
@ -27,6 +27,18 @@ app.configure ->
|
||||||
|
|
||||||
DispatchManager.createAndStartDispatchers(Settings.dispatcherCount || 10)
|
DispatchManager.createAndStartDispatchers(Settings.dispatcherCount || 10)
|
||||||
|
|
||||||
|
app.param 'project_id', (req, res, next, project_id) ->
|
||||||
|
if project_id?.match /^[0-9a-f]{24}$/
|
||||||
|
next()
|
||||||
|
else
|
||||||
|
next new Error("invalid project id")
|
||||||
|
|
||||||
|
app.param 'doc_id', (req, res, next, doc_id) ->
|
||||||
|
if doc_id?.match /^[0-9a-f]{24}$/
|
||||||
|
next()
|
||||||
|
else
|
||||||
|
next new Error("invalid doc id")
|
||||||
|
|
||||||
app.get '/project/:project_id/doc/:doc_id', HttpController.getDoc
|
app.get '/project/:project_id/doc/:doc_id', HttpController.getDoc
|
||||||
app.post '/project/:project_id/doc/:doc_id', HttpController.setDoc
|
app.post '/project/:project_id/doc/:doc_id', HttpController.setDoc
|
||||||
app.post '/project/:project_id/doc/:doc_id/flush', HttpController.flushDocIfLoaded
|
app.post '/project/:project_id/doc/:doc_id/flush', HttpController.flushDocIfLoaded
|
||||||
|
|
Loading…
Reference in a new issue