1
0
ohmyform/app/routes/forms.server.routes.js

30 lines
797 B
JavaScript
Raw Normal View History

2015-06-29 15:51:29 -07:00
'use strict';
/**
* Module dependencies.
*/
var users = require('../../app/controllers/users.server.controller'),
forms = require('../../app/controllers/forms.server.controller');
module.exports = function(app) {
// Form Routes
app.route('/upload/pdf')
2015-07-02 16:34:00 -07:00
.post(forms.uploadPDF);
2015-06-29 15:51:29 -07:00
app.route('/forms')
2015-07-01 16:14:39 -07:00
.get(users.requiresLogin, forms.list)
2015-06-29 15:51:29 -07:00
.post(users.requiresLogin, forms.create);
2015-07-02 16:34:00 -07:00
app.route('/forms/:formId([a-zA-Z0-9]+)')
2015-06-29 15:51:29 -07:00
.get(forms.read)
2015-07-02 16:34:00 -07:00
// .post(forms.createSubmission)
2015-06-29 15:51:29 -07:00
.put(users.requiresLogin, forms.hasAuthorization, forms.update)
2015-06-30 10:36:51 -07:00
.delete(users.requiresLogin, forms.hasAuthorization, forms.delete);
2015-06-29 15:51:29 -07:00
2015-07-02 16:34:00 -07:00
app.route('/forms/:formId([a-zA-Z0-9]+)/submissions')
.get(forms.listSubmissions);
2015-06-29 15:51:29 -07:00
// Finish by binding the form middleware
app.param('formId', forms.formByID);
};