mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
More api documentation updates
This commit is contained in:
@@ -14,6 +14,16 @@
|
||||
* limitations under the License.
|
||||
**/
|
||||
|
||||
|
||||
/**
|
||||
* This module provides an Express application to serve the Node-RED editor.
|
||||
*
|
||||
* It implements the Node-RED HTTP Admin API the Editor uses to interact
|
||||
* with the Node-RED runtime.
|
||||
*
|
||||
* @namespace @node-red/editor-api
|
||||
*/
|
||||
|
||||
var express = require("express");
|
||||
var bodyParser = require("body-parser");
|
||||
var util = require('util');
|
||||
@@ -28,6 +38,15 @@ var adminApp;
|
||||
var server;
|
||||
var editor;
|
||||
|
||||
|
||||
/**
|
||||
* Initialise the module.
|
||||
* @param {Object} settings The runtime settings
|
||||
* @param {HTTPServer} server An instance of HTTP Server
|
||||
* @param {Storage} storage An instance of Node-RED Storage
|
||||
* @param {Runtime} runtimeAPI An instance of Node-RED Runtime
|
||||
* @memberof @node-red/editor-api
|
||||
*/
|
||||
function init(settings,_server,storage,runtimeAPI) {
|
||||
server = _server;
|
||||
if (settings.httpAdminRoot !== false) {
|
||||
@@ -80,6 +99,12 @@ function init(settings,_server,storage,runtimeAPI) {
|
||||
adminApp = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Start the module.
|
||||
* @return {Promise} resolves when the application is ready to handle requests
|
||||
* @memberof @node-red/editor-api
|
||||
*/
|
||||
function start() {
|
||||
if (editor) {
|
||||
return editor.start();
|
||||
@@ -87,6 +112,12 @@ function start() {
|
||||
return when.resolve();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop the module.
|
||||
* @return {Promise} resolves when the application is stopped
|
||||
* @memberof @node-red/editor-api
|
||||
*/
|
||||
function stop() {
|
||||
if (editor) {
|
||||
editor.stop();
|
||||
@@ -97,8 +128,18 @@ module.exports = {
|
||||
init: init,
|
||||
start: start,
|
||||
stop: stop,
|
||||
|
||||
/**
|
||||
* @memberof @node-red/editor-api
|
||||
* @mixes @node-red/editor-api_auth
|
||||
*/
|
||||
auth: {
|
||||
needsPermission: auth.needsPermission
|
||||
},
|
||||
/**
|
||||
* The Express app used to serve the Node-RED Editor
|
||||
* @type ExpressApplication
|
||||
* @memberof @node-red/editor-api
|
||||
*/
|
||||
get httpAdmin() { return adminApp; }
|
||||
};
|
||||
|
Reference in New Issue
Block a user