I'm new to node-RED and bluemix and tutorials aren't helping a lot.
I was trying to create a web app with http nodes for truck drivers to input their ID (or an order ID, doesn't matter) and click the button (which would send the ID to a mongodb) to confirm that the delivery has been successful.
The problems are: my function doesn't return anything (should return the ID) and I also can't connect to mongodb.
Here is my link and the json code for the flow https://isitrans.eu-gb.mybluemix.net/red/#
[{"id":"bcb311e.217d9f","type":"tab","label":"ISITransportes"},{"id":"1ae3ee2d.5687b2","type":"http in","z":"bcb311e.217d9f","name":"GetDestino","url":"/destino","method":"get","swaggerDoc":"","x":185,"y":146,"wires":[["e63d2949.5b1728"]]},{"id":"e63d2949.5b1728","type":"template","z":"bcb311e.217d9f","name":"Template","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<!DOCTYPE html>\n<html>\n<head>\n <title>ISI Transportes</title>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css\">\n <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js\"></script>\n <script src=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js\"></script>\n</head>\n<body>\n\n<div class=\"container\">\n <div class=\"jumbotron\">\n <h1>ISI Transportes</h1> \n </div>\n \n</div>\n<div class=\"container\">\n \n \n\t<br>\n\t \t<label for=\"text\">ID Pedido:</label>\n\t\t<input type=\"text\" class=\"form-control\" id=\"inicio\">\n\t\t<br>\n\t\t<button type=\"submit\" class=\"btn btn-primary btn-lg\">INICIO</button>\n \n</div>\n\n</body>\n</html>","x":481,"y":146,"wires":[["fff7a58f.9eb3f8"]]},{"id":"fff7a58f.9eb3f8","type":"http response","z":"bcb311e.217d9f","name":"","x":694,"y":147,"wires":[]},{"id":"b9c3e0ea.4dc5e","type":"http in","z":"bcb311e.217d9f","name":"PostDestino","url":"/destino","method":"post","swaggerDoc":"","x":196,"y":383,"wires":[["d6f1a2bf.4257c"]]},{"id":"8b24e3e3.a2981","type":"debug","z":"bcb311e.217d9f","name":"","active":true,"console":"false","complete":"payload","x":697,"y":383,"wires":[]},{"id":"d6f1a2bf.4257c","type":"function","z":"bcb311e.217d9f","name":"insert ID","func":"document.getElementById(\"inicio\").value = msg.payload;\n\nreturn msg;","outputs":1,"noerr":0,"x":446,"y":321,"wires":[["8b24e3e3.a2981"]]}]
via ZacdelaRocha
No comments:
Post a Comment