1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

Remove deprecated use of RED.app

This commit is contained in:
Nick O'Leary 2014-02-23 21:06:29 +00:00
parent 448f83e337
commit 9b41a4e051
3 changed files with 9 additions and 9 deletions

View File

@ -30,7 +30,7 @@ RED.nodes.registerType("emoncms-server",EmoncmsServerNode);
var querystring = require('querystring'); var querystring = require('querystring');
RED.app.get('/emoncms-server/:id',function(req,res) { RED.httpAdmin.get('/emoncms-server/:id',function(req,res) {
var credentials = RED.nodes.getCredentials(req.params.id); var credentials = RED.nodes.getCredentials(req.params.id);
if (credentials) { if (credentials) {
res.send(JSON.stringify({apikey:credentials.apikey})); res.send(JSON.stringify({apikey:credentials.apikey}));
@ -39,12 +39,12 @@ RED.app.get('/emoncms-server/:id',function(req,res) {
} }
}); });
RED.app.delete('/emoncms-server/:id',function(req,res) { RED.httpAdmin.delete('/emoncms-server/:id',function(req,res) {
RED.nodes.deleteCredentials(req.params.id); RED.nodes.deleteCredentials(req.params.id);
res.send(200); res.send(200);
}); });
RED.app.post('/emoncms-server/:id',function(req,res) { RED.httpAdmin.post('/emoncms-server/:id',function(req,res) {
var body = ""; var body = "";
req.on('data', function(chunk) { req.on('data', function(chunk) {

View File

@ -27,7 +27,7 @@ function AWSCredentialsNode(n) {
} }
RED.nodes.registerType("aws credentials", AWSCredentialsNode); RED.nodes.registerType("aws credentials", AWSCredentialsNode);
RED.app.get('/aws-credentials/:id', function(req, res) { RED.httpAdmin.get('/aws-credentials/:id', function(req, res) {
var credentials = RED.nodes.getCredentials(req.params.id); var credentials = RED.nodes.getCredentials(req.params.id);
if (credentials) { if (credentials) {
res.send(JSON.stringify({ accessKey: credentials.accessKey, secretAccessKey: credentials.secretAccessKey })); res.send(JSON.stringify({ accessKey: credentials.accessKey, secretAccessKey: credentials.secretAccessKey }));
@ -36,12 +36,12 @@ RED.app.get('/aws-credentials/:id', function(req, res) {
} }
}); });
RED.app.delete('/aws-credentials/:id', function(req, res) { RED.httpAdmin.delete('/aws-credentials/:id', function(req, res) {
RED.nodes.deleteCredentials(req.params.id); RED.nodes.deleteCredentials(req.params.id);
res.send(200); res.send(200);
}); });
RED.app.post('/aws-credentials/:id', function(req, res) { RED.httpAdmin.post('/aws-credentials/:id', function(req, res) {
var body = ""; var body = "";
req.on("data", function(chunk) { req.on("data", function(chunk) {
body += chunk; body += chunk;

View File

@ -19,7 +19,7 @@ var pg=require('pg');
var named=require('node-postgres-named'); var named=require('node-postgres-named');
var querystring = require('querystring'); var querystring = require('querystring');
RED.app.get('/postgresdb/:id',function(req,res) { RED.httpAdmin.get('/postgresdb/:id',function(req,res) {
var credentials = RED.nodes.getCredentials(req.params.id); var credentials = RED.nodes.getCredentials(req.params.id);
if (credentials) { if (credentials) {
res.send(JSON.stringify({user:credentials.user,hasPassword:(credentials.password&&credentials.password!="")})); res.send(JSON.stringify({user:credentials.user,hasPassword:(credentials.password&&credentials.password!="")}));
@ -28,12 +28,12 @@ RED.app.get('/postgresdb/:id',function(req,res) {
} }
}); });
RED.app.delete('/postgresdb/:id',function(req,res) { RED.httpAdmin.delete('/postgresdb/:id',function(req,res) {
RED.nodes.deleteCredentials(req.params.id); RED.nodes.deleteCredentials(req.params.id);
res.send(200); res.send(200);
}); });
RED.app.post('/postgresdb/:id',function(req,res) { RED.httpAdmin.post('/postgresdb/:id',function(req,res) {
var body = ""; var body = "";
req.on('data', function(chunk) { req.on('data', function(chunk) {
body+=chunk; body+=chunk;