我正在学习教程:“在5分钟内使用Node-RED构建实时聊天应用程序” http://www.ibm.com/developerworks/cloud/library/cl-rtchat-app/
但是未启用“部署”按钮。所以我无法部署。
我已经安装了CF命令行并为我的应用程序运行“ push”。这是我从仪表板“ CFApp”下的“开始编码”中学到的。成功了。
该“推送”与Node-Red编辑器中的“部署”相同吗?
谢谢。
郑
最佳答案
部署按钮与CF按钮不同。节点红色的图形用户界面中提供了节点红色的部署按钮。
创建节点红色应用程序后,必须启动它。
这是教程第1步的项目符号3。在Bluemix仪表板上,单击应用程序名称以启动它。
将显示节点红色应用程序的主窗口(本教程的步骤1上的项目符号4)。
单击红色大按钮“转到您的节点红色流编辑器”将打开节点红色流编辑器(在步骤1的项目符号5上显示)。此时,您应该会看到一个空白表,并且应该禁用右上角的“部署”按钮。
按照步骤2的说明导入红色节点流(为方便起见,在下面将其包括在内):
[{"id":"bc740d23.438bf","type":"websocket-listener","path":"/ws/chat","wholemsg":"false"},{"id":"c86da933.379258","type":"websocket in","name":"","server":"bc740d23.438bf","x":112,"y":61,"z":"d46b9957.2b9468","wires":[["f9476129.06b8a"]]},{"id":"f9476129.06b8a","type":"function","name":"","func":"delete msg._session;\nreturn msg;\n\n","outputs":1,"valid":true,"x":286,"y":61,"z":"d46b9957.2b9468","wires":[["bda54943.425ab8"]]},{"id":"bda54943.425ab8","type":"websocket out","name":"","server":"bc740d23.438bf","x":467,"y":61,"z":"d46b9957.2b9468","wires":[]},{"id":"df7af34a.20851","type":"http in","name":"","url":"/chat","method":"get","x":120,"y":129,"z":"d46b9957.2b9468","wires":[["969892ad.69677"]]},{"id":"969892ad.69677","type":"template","name":"","field":"","template":"<head>\n <meta name=\"viewport\" content=\"width=320, initial-scale=1\">\n <title>Chat</title>\n</head>\n\n<body>\n <div id=\"wrapper\">\n <div id=\"chat_box\" class=\"content\"></div>\n\n <div id=\"footer\">\n <div class=\"content\">\n <input type=\"text\" id=\"user\" placeholder=\"Who are you?\" />\n <input type=\"text\" id=\"message\" placeholder=\"What do you want to say?\" />\n <input type=\"button\" id=\"send_btn\" value=\"Send\" onclick=\"sendMessage()\">\n </div>\n </div>\n </div>\n</body>\n\n<script type=\"text/javascript\">\n var wsUri = \"ws://{{req.headers.host}}/ws/chat\";\n var ws = new WebSocket(wsUri);\n\n function createSystemMessage(message) {\n var message = document.createTextNode(message);\n\n var messageBox = document.createElement('p');\n messageBox.className = 'system';\n\n messageBox.appendChild(message);\n\n var chat = document.getElementById('chat_box');\n chat.appendChild(messageBox);\n }\n\n function createUserMessage(user, message) {\n var user = document.createTextNode(user + ': ');\n\n var userBox = document.createElement('span');\n userBox.className = 'username';\n userBox.appendChild(user);\n\n var message = document.createTextNode(message);\n\n var messageBox = document.createElement('p');\n messageBox.appendChild(userBox);\n messageBox.appendChild(message);\n\n var chat = document.getElementById('chat_box');\n chat.appendChild(messageBox);\n }\n\n ws.onopen = function(ev) {\n createSystemMessage('[Connected]');\n };\n\n ws.onclose = function(ev) {\n createSystemMessage('[Disconnected]');\n }\n\n ws.onmessage = function(ev) {\n var payload = JSON.parse(ev.data);\n createUserMessage(payload.user, payload.message);\n\n var chat = document.getElementById('chat_box');\n chat.scrollTop = chat.scrollHeight;\n }\n\n function sendMessage() {\n var user = document.getElementById('user');\n var message = document.getElementById('message');\n\n var payload = {\n message: message.value,\n user: user.value,\n ts: (new Date()).getTime()\n };\n\n ws.send(JSON.stringify(payload));\n message.value = \"\";\n };\n</script>\n\n<style type=\"text/css\">\n * {\n font-family: \"Palatino Linotype\", \"Book Antiqua\", Palatino, serif;\n font-style: italic;\n font-size: 24px;\n }\n\n html, body, #wrapper {\n margin: 0;\n padding: 0;\n height: 100%;\n }\n\n #wrapper {\n background-color: #ecf0f1;\n }\n\n #chat_box {\n box-sizing: border-box;\n height: 100%;\n overflow: auto;\n padding-bottom: 50px;\n }\n\n #footer {\n box-sizing: border-box;\n position: fixed;\n bottom: 0;\n height: 50px;\n width: 100%;\n background-color: #2980b9;\n }\n\n #footer .content {\n padding-top: 4px;\n position: relative;\n }\n\n #user { width: 20%; }\n #message { width: 68%; }\n #send_btn {\n width: 10%;\n position: absolute;\n right: 0;\n bottom: 0;\n margin: 0;\n }\n\n .content {\n width: 70%;\n margin: 0 auto;\n }\n\n input[type=\"text\"],\n input[type=\"button\"] {\n border: 0;\n color: #fff;\n }\n\n input[type=\"text\"] {\n background-color: #146EA8;\n padding: 3px 10px;\n }\n\n input[type=\"button\"] {\n background-color: #f39c12;\n border-right: 2px solid #e67e22;\n border-bottom: 2px solid #e67e22;\n min-width: 70px;\n display: inline-block;\n }\n\n input[type=\"button\"]:hover {\n background-color: #e67e22;\n border-right: 2px solid #f39c12;\n border-bottom: 2px solid #f39c12;\n cursor: pointer;\n }\n\n .system,\n .username {\n color: #aaa;\n font-style: italic;\n font-family: monospace;\n font-size: 16px;\n }\n\n @media(max-width: 1000px) {\n .content { width: 90%; }\n }\n\n @media(max-width: 780px) {\n #footer { height: 91px; }\n #chat_box { padding-bottom: 91px; }\n\n #user { width: 100%; }\n #message { width: 80%; }\n }\n\n @media(max-width: 400px) {\n #footer { height: 135px; }\n #chat_box { padding-bottom: 135px; }\n\n #message { width: 100%; }\n #send_btn {\n position: relative;\n margin-top: 3px;\n width: 100%;\n }\n }\n</style>\n","x":286,"y":129,"z":"d46b9957.2b9468","wires":[["82cb0232.7d35"]]},{"id":"82cb0232.7d35","type":"http response","name":"","x":429,"y":129,"z":"d46b9957.2b9468","wires":[]}]
请按照其他步骤导入以上流程,部署并运行该应用程序。
关于node.js - bluemix Node 红色流编辑器的“deploy”按钮未启用,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32437048/