1
0
Fork 0
arangodb/js/actions/api-foxx.js

138 lines
4.1 KiB
JavaScript

/*jslint indent: 2, nomen: true, maxlen: 100, sloppy: true, vars: true, white: true, plusplus: true */
/*global require, exports, module */
////////////////////////////////////////////////////////////////////////////////
/// @brief foxx administration actions
///
/// @file
///
/// DISCLAIMER
///
/// Copyright 2010-2012 triagens GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is triAGENS GmbH, Cologne, Germany
///
/// @author Dr. Frank Celler
/// @author Copyright 2012, triAGENS GmbH, Cologne, Germany
////////////////////////////////////////////////////////////////////////////////
var arangodb = require("org/arangodb");
var actions = require("org/arangodb/actions");
var foxx = require("org/arangodb/foxx");
// -----------------------------------------------------------------------------
// --SECTION-- public functions
// -----------------------------------------------------------------------------
////////////////////////////////////////////////////////////////////////////////
/// @addtogroup ArangoAPI
/// @{
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/// @brief installs a FOXX application
////////////////////////////////////////////////////////////////////////////////
actions.defineHttp({
url : "_admin/foxx/install",
context : "admin",
prefix : false,
callback : function (req, res) {
'use strict';
var result;
var body = actions.getJsonBody(req, res);
if (body === undefined) {
return;
}
var name = body.name;
var mount = body.mount;
var options = body.options || {};
result = foxx.installApp(name, mount, options);
actions.resultOk(req, res, actions.HTTP_OK, result);
}
});
////////////////////////////////////////////////////////////////////////////////
/// @brief installs a FOXX application
////////////////////////////////////////////////////////////////////////////////
actions.defineHttp({
url : "_admin/foxx/dev-install",
context : "admin",
prefix : false,
callback : function (req, res) {
'use strict';
var result;
var body = actions.getJsonBody(req, res);
if (body === undefined) {
return;
}
var name = body.name;
var mount = body.mount;
var options = body.options || {};
result = foxx.installDevApp(name, mount, options);
actions.resultOk(req, res, actions.HTTP_OK, result);
}
});
////////////////////////////////////////////////////////////////////////////////
/// @brief uninstalls a FOXX application
////////////////////////////////////////////////////////////////////////////////
actions.defineHttp({
url : "_admin/foxx/uninstall",
context : "admin",
prefix : false,
callback : function (req, res) {
'use strict';
var result;
var body = actions.getJsonBody(req, res);
if (body === undefined) {
return;
}
var key = body.key;
result = foxx.uninstallApp(key);
actions.resultOk(req, res, actions.HTTP_OK, result);
}
});
////////////////////////////////////////////////////////////////////////////////
/// @}
////////////////////////////////////////////////////////////////////////////////
// -----------------------------------------------------------------------------
// --SECTION-- END-OF-FILE
// -----------------------------------------------------------------------------
// Local Variables:
// mode: outline-minor
// outline-regexp: "/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @\\}"
// End: