mirror of https://gitee.com/bigwinds/arangodb
action cleanup
This commit is contained in:
parent
e76fc8a81d
commit
dfd5099eee
|
@ -41,11 +41,15 @@ actions.defineHttp({
|
|||
lon : "number"
|
||||
},
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
callback : function (req, res) {
|
||||
=======
|
||||
function : function (req, res) {
|
||||
>>>>>>> unfinished actions cleanup
|
||||
=======
|
||||
callback : function (req, res) {
|
||||
>>>>>>> action cleanup
|
||||
var result = req.collection.near(req.lat, req.lon).distance();
|
||||
|
||||
actions.queryResult(req, res, result);
|
||||
|
@ -67,11 +71,15 @@ actions.defineHttp({
|
|||
radius : "number"
|
||||
},
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
callback : function (req, res) {
|
||||
=======
|
||||
function : function (req, res) {
|
||||
>>>>>>> unfinished actions cleanup
|
||||
=======
|
||||
callback : function (req, res) {
|
||||
>>>>>>> action cleanup
|
||||
var result = req.collection.within(req.lat, req.lon, req.radius).distance();
|
||||
|
||||
actions.queryResult(req, res, result);
|
||||
|
|
|
@ -343,13 +343,51 @@ function actionError (req, res, err) {
|
|||
|
||||
try {
|
||||
internal.defineAction(url, "CLIENT", callback, parameter);
|
||||
console.debug("defining action '" + url + "' in domain(s) " + domain);
|
||||
console.trace("defining action '" + url + "' in domain(s) " + domain);
|
||||
}
|
||||
catch (err) {
|
||||
console.error("action '" + url + "' encountered error: " + err);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns a result
|
||||
///
|
||||
/// @FUN{actionResult(@FA{req}, @FA{res}, @FA{code}, @FA{result}, @FA{headers})}
|
||||
///
|
||||
/// The functions returns a result object. @FA{code} is the status code
|
||||
/// to return.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function actionResult (req, res, code, result, headers) {
|
||||
res.responseCode = code;
|
||||
|
||||
if (result) {
|
||||
res.contentType = "application/json";
|
||||
res.body = JSON.stringify(result);
|
||||
}
|
||||
|
||||
if (headers != undefined) {
|
||||
res.headers = headers;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns an error
|
||||
///
|
||||
/// @FUN{actionError(@FA{req}, @FA{res}, @FA{errorMessage})}
|
||||
///
|
||||
/// The functions returns an error message. The status code is 500 and the
|
||||
/// returned object is an array with an attribute @LIT{error} containing
|
||||
/// the error message @FA{errorMessage}.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function actionError (req, res, err) {
|
||||
res.responseCode = 500;
|
||||
res.contentType = "application/json";
|
||||
res.body = JSON.stringify({ 'error' : "" + err });
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/// @brief returns a result of a query as documents
|
||||
///
|
||||
|
@ -460,6 +498,7 @@ function queryReferences (req, res, query) {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
<<<<<<< HEAD
|
||||
/// @brief returns a result
|
||||
///
|
||||
<<<<<<< HEAD
|
||||
|
@ -561,6 +600,8 @@ function actionError (req, res, err) {
|
|||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
=======
|
||||
>>>>>>> action cleanup
|
||||
/// @}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
Loading…
Reference in New Issue