iceflow-server
Advanced tools
Comparing version 0.1.9 to 0.2.0
@@ -113,8 +113,6 @@ 'use strict'; | ||
//breaks up the action, the url structure determines what action to use by convention, example /page/do = getPageDo | ||
const frags = _.compact(specOptions.action.split('/')); | ||
//check to convert to show action or not | ||
const file = frags[1] ? (isNaN(frags[1]) ? frags[1] : 'Show') : ''; | ||
const dirData= this.getDirDateFromRoute(specOptions.action); | ||
//require the action | ||
const action = !req.testMode ? require('../../../server/api/actions/' + frags[0] + '/get' + file) : require('../tests/stubs/action')(req.testMode); | ||
const action = !req.testMode ? require('../../../server/api/actions/' + dirData.dir + '/get' + dirData.file) : require('../tests/stubs/action')(req.testMode); | ||
const requestData = { | ||
@@ -390,4 +388,28 @@ url: (specOptions.api ? conf.apis[specOptions.api] : '/api') + specOptions.action | ||
getDirDateFromRoute(route){ | ||
//breaks up the action, the url structure determines what action to use by convention, example /page/do = getPageDo | ||
const frags = _.compact(route.split('/')); | ||
const dir = frags.shift(); | ||
var file = ''; | ||
if(frags.length === 1){ | ||
file += frags[0] ? (isNaN(frags[0]) ? '_' + frags[0].toLowerCase() : '_show') : ''; | ||
}else if(frags.length > 1){ | ||
let tail = frags.pop(); | ||
if(!isNaN(tail)){ | ||
frags.push('_show'); | ||
} | ||
file += '_' + frags.join('_'); | ||
} | ||
return { | ||
file: file.toLowerCase(), | ||
dir : dir | ||
}; | ||
} | ||
} | ||
module.exports = new HttpService(); |
@@ -66,3 +66,3 @@ { | ||
}, | ||
"version": "0.1.9" | ||
"version": "0.2.0" | ||
} |
@@ -216,3 +216,3 @@ #Iceflow Server | ||
would get api/actions/users/getExample.js | ||
would get api/actions/users/get_example.js | ||
@@ -223,3 +223,3 @@ { | ||
would get api/actions/users/getShow.js. Numeric values for a specific resource get converted to getShow. | ||
would get api/actions/users/get_show.js. Numeric values for a specific resource get converted to getShow. | ||
@@ -226,0 +226,0 @@ ``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
49106
1150