fixed subdomain for problem
This commit is contained in:
parent
ecfccd803f
commit
2d15ae3dd5
|
@ -226,7 +226,6 @@ exports.read = function(req, res) {
|
|||
});
|
||||
}
|
||||
return res.json(newForm);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,11 +7,11 @@ var forms = require('../../app/controllers/forms.server.controller'),
|
|||
core = require('../../app/controllers/core.server.controller');
|
||||
|
||||
module.exports = function(app) {
|
||||
// Root routing
|
||||
// Core routing
|
||||
app.route('/').get(core.index);
|
||||
|
||||
app.route('/subdomain/api/').get(core.redoc);
|
||||
app.route('/subdomain/^(?!api$)[A-Za-z0-9]*/').get(core.form);
|
||||
app.route('/subdomain/^(?!api$)[A-Za-z0-9]*/forms/:formId([a-zA-Z0-9]+)')
|
||||
.get(forms.read)
|
||||
app.route('/subdomain/:userSlug((?!api$)[A-Za-z0-9]+)/').get(core.form);
|
||||
app.route('/subdomain/:userSlug((?!api$)[A-Za-z0-9]+)/forms/:formId([a-zA-Z0-9]+)').get(forms.read)
|
||||
.post(forms.createSubmission);
|
||||
};
|
||||
|
|
|
@ -31,7 +31,7 @@ if( fs.existsSync('./config/env/api_keys.js') ){
|
|||
exports,
|
||||
require('./env/api_keys')
|
||||
);
|
||||
}else {
|
||||
} else {
|
||||
module.exports = exports;
|
||||
}
|
||||
|
||||
|
|
|
@ -81,8 +81,14 @@ module.exports = function(db) {
|
|||
|
||||
var urlPath = url.parse(req.url).path.split('/');
|
||||
if(urlPath.indexOf('static') > -1){
|
||||
//console.log("STATIC FILE\n\n\n\n");
|
||||
urlPath.splice(1,1);
|
||||
req.root = 'https://' + config.baseUrl + urlPath.join('/');
|
||||
console.log(req.root);
|
||||
return next();
|
||||
}
|
||||
|
||||
if(urlPath.indexOf('users') > -1 && urlPath.indexOf('me') > -1){
|
||||
return next();
|
||||
}
|
||||
|
||||
|
@ -105,8 +111,7 @@ module.exports = function(db) {
|
|||
}
|
||||
|
||||
User.findOne({username: req.subdomains.reverse()[0]}).exec(function (err, user) {
|
||||
console.log("user");
|
||||
console.log(user);
|
||||
|
||||
if (err) {
|
||||
console.log(err);
|
||||
req.subdomains = null;
|
||||
|
@ -127,6 +132,7 @@ module.exports = function(db) {
|
|||
|
||||
// TODO: check path and query strings are preserved
|
||||
// reassign url
|
||||
console.log("path: "+path);
|
||||
req.url = path;
|
||||
|
||||
req.userId = user._id;
|
||||
|
|
|
@ -8,7 +8,7 @@ var __indexOf = [].indexOf || function(item) {
|
|||
return -1;
|
||||
};
|
||||
|
||||
angular.module('forms').directive('fieldDirective', ['$http', '$compile', '$rootScope', '$templateCache', 'supportedFields',
|
||||
angular.module('view-form').directive('fieldDirective', ['$http', '$compile', '$rootScope', '$templateCache', 'supportedFields',
|
||||
function($http, $compile, $rootScope, $templateCache, supportedFields) {
|
||||
|
||||
var getTemplateUrl = function(fieldType) {
|
||||
|
|
Loading…
Reference in a new issue