overleaf/services/web/app/coffee/Features/Templates/TemplatesRouter.coffee

16 lines
727 B
CoffeeScript
Raw Normal View History

2018-05-31 06:12:31 -04:00
AuthenticationController = require('../Authentication/AuthenticationController')
TemplatesController = require("./TemplatesController")
TemplatesMiddleware = require('./TemplatesMiddleware')
RateLimiterMiddleware = require('../Security/RateLimiterMiddleware')
2018-05-31 06:12:31 -04:00
module.exports =
apply: (app)->
app.get '/project/new/template/:Template_version_id', TemplatesMiddleware.saveTemplateDataInSession, AuthenticationController.requireLogin(), TemplatesController.getV1Template
2018-05-31 06:12:31 -04:00
app.post '/project/new/template', AuthenticationController.requireLogin(), RateLimiterMiddleware.rateLimit({
endpointName: "create-project-from-template"
maxRequests: 20
timeInterval: 60
}), TemplatesController.createProjectFromV1Template