mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
add route parameters
This commit is contained in:
parent
7a28fb58e7
commit
f95fc2f779
1 changed files with 12 additions and 0 deletions
|
@ -16,6 +16,18 @@ app = express()
|
|||
|
||||
app.use Metrics.http.monitor(logger)
|
||||
|
||||
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', HttpController.getAllDocs
|
||||
app.get '/project/:project_id/doc/:doc_id', HttpController.getDoc
|
||||
app.get '/project/:project_id/doc/:doc_id/raw', HttpController.getRawDoc
|
||||
|
|
Loading…
Reference in a new issue