mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Tidy up API passed to node modules
This commit is contained in:
@@ -42,7 +42,6 @@ function init(_server,runtime) {
|
||||
runtime.events.on("node-status",handleStatus);
|
||||
}
|
||||
|
||||
|
||||
function start() {
|
||||
var Tokens = require("./auth/tokens");
|
||||
var Users = require("./auth/users");
|
||||
|
@@ -20,7 +20,7 @@ var api;
|
||||
module.exports = {
|
||||
init: function(runtime) {
|
||||
log = runtime.log;
|
||||
api = runtime.api;
|
||||
api = runtime.nodes;
|
||||
},
|
||||
get: function (req, res) {
|
||||
// TODO: It should verify the given node id is of the type specified -
|
||||
|
@@ -21,7 +21,7 @@ var settings;
|
||||
module.exports = {
|
||||
init: function(runtime) {
|
||||
settings = runtime.settings;
|
||||
redNodes = runtime.api;
|
||||
redNodes = runtime.nodes;
|
||||
log = runtime.log;
|
||||
},
|
||||
get: function(req,res) {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2014 IBM Corp.
|
||||
* Copyright 2014, 2015 IBM Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -38,6 +38,7 @@ var i18n;
|
||||
var log;
|
||||
var adminApp;
|
||||
var nodeApp;
|
||||
var server;
|
||||
|
||||
var errorHandler = function(err,req,res,next) {
|
||||
if (err.message === "request entity too large") {
|
||||
@@ -49,7 +50,8 @@ var errorHandler = function(err,req,res,next) {
|
||||
res.status(400).json({error:"unexpected_error", message:err.toString()});
|
||||
};
|
||||
|
||||
function init(server,runtime) {
|
||||
function init(_server,runtime) {
|
||||
server = _server;
|
||||
var settings = runtime.settings;
|
||||
i18n = runtime.i18n;
|
||||
log = runtime.log;
|
||||
@@ -150,6 +152,7 @@ module.exports = {
|
||||
comms: {
|
||||
publish: comms.publish
|
||||
},
|
||||
adminApp: function() { return adminApp; },
|
||||
nodeApp: function() { return nodeApp; }
|
||||
get adminApp() { return adminApp; },
|
||||
get nodeApp() { return nodeApp; },
|
||||
get server() { return server; }
|
||||
};
|
||||
|
@@ -24,7 +24,7 @@ var settings;
|
||||
|
||||
module.exports = {
|
||||
init: function(runtime) {
|
||||
redNodes = runtime.api;
|
||||
redNodes = runtime.nodes;
|
||||
log = runtime.log;
|
||||
i18n = runtime.i18n;
|
||||
settings = runtime.settings;
|
||||
|
Reference in New Issue
Block a user