mirror of https://gitee.com/bigwinds/arangodb
a string as action is mapped to a prefix controller
This commit is contained in:
parent
a5f83c3e8d
commit
049009ba5a
|
@ -368,7 +368,6 @@
|
|||
/// <li>@ref UserManualActionsContentAction</li>
|
||||
/// <li>@ref UserManualActionsContentController</li>
|
||||
/// <li>@ref UserManualActionsContentPrefix</li>
|
||||
/// <li>@ref UserManualActionsContentMethod</li>
|
||||
/// </ul>
|
||||
/// </li>
|
||||
/// <li>@ref UserManualActionsReqRes</li>
|
||||
|
@ -838,18 +837,6 @@
|
|||
/// If you use an prefix controller, you should make certain that no unwanted
|
||||
/// actions are available under the prefix.
|
||||
///
|
||||
/// @subsection UserManualActionsContentMethod Method Restriction
|
||||
///
|
||||
/// You can restrict the match to specific methods.
|
||||
///
|
||||
/// If the definition is
|
||||
///
|
||||
/// @code
|
||||
/// { controller: "org/arangodb/actions/echoController", methods: [ "post", "put" ] }
|
||||
/// @endcode
|
||||
///
|
||||
/// then only @LIT{POST} and @LIT{PUT} requests will match.
|
||||
///
|
||||
/// @section UserManualActionsReqRes Requests and Responses
|
||||
///////////////////////////////////////////////////////////
|
||||
///
|
||||
|
|
|
@ -188,35 +188,7 @@ function lookupCallbackAction (action) {
|
|||
var module;
|
||||
|
||||
if (typeof action === 'string') {
|
||||
path = action.split("/");
|
||||
name = path.pop();
|
||||
func = null;
|
||||
|
||||
try {
|
||||
module = require(path.join("/"));
|
||||
|
||||
if (module.hasOwnProperty(name)) {
|
||||
func = module[name];
|
||||
}
|
||||
else {
|
||||
console.error("cannot find action named '%s' in module '%s'", name, path.join("/"));
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
console.error("cannot find action named '%s' in module '%s': %s",
|
||||
name, path.join("/"), String(err));
|
||||
return null;
|
||||
}
|
||||
|
||||
if (func === null || typeof func !== 'function') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
controller: func,
|
||||
options: {},
|
||||
methods: exports.ALL_METHODS
|
||||
};
|
||||
return lookupCallbackAction({ prefixController: action });
|
||||
}
|
||||
|
||||
if (action.hasOwnProperty('do')) {
|
||||
|
|
Loading…
Reference in New Issue