2021年9月16日 星期四

Node-Red + MySQL Database Query

 Node-Red  + MySQL  Database  Query 









[{"id":"571a8ee8.5883d","type":"http in","z":"ad715e3a.f672","name":"","url":"/allbook","method":"get","upload":false,"swaggerDoc":"","x":110,"y":80,"wires":[["71ec3368.c3cf5c"]]},{"id":"7eb81f73.1710c","type":"template","z":"ad715e3a.f672","name":"HTML範本網頁","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<html>\n    <head>\n        <title>Book</title>\n    </head>\n    <body>\n      <table border=\"1\">\n       {{#payload}}\n          <tr><td>{{id}}</td><td>{{title}}</td><td>{{price}}</td></tr>\n       {{/payload}}\n      </table>\n    </body>\n</html>","x":580,"y":80,"wires":[["766f42f9.87fbcc"]]},{"id":"71ec3368.c3cf5c","type":"function","z":"ad715e3a.f672","name":"SQL Query","func":"msg.topic = \"SELECT * FROM book\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":270,"y":80,"wires":[["1c7d1dcf.bb2ad2"]]},{"id":"766f42f9.87fbcc","type":"http response","z":"ad715e3a.f672","name":"","x":730,"y":80,"wires":[]},{"id":"1c7d1dcf.bb2ad2","type":"mysql","z":"ad715e3a.f672","mydb":"51c3503.61936b","name":"","x":420,"y":80,"wires":[["7eb81f73.1710c"]]},{"id":"972d4261.edfa3","type":"http in","z":"ad715e3a.f672","name":"","url":"/onebook","method":"get","swaggerDoc":"","x":110,"y":180,"wires":[["df8ee7cd.97cd48"]]},{"id":"ae181702.047de8","type":"template","z":"ad715e3a.f672","name":"HTML範本網頁","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<html>\n    <head>\n        <title>Book</title>\n    </head>\n    <body>\n        <h2>書號: {{payload.id}}</h2>\n        <h2>書名: {{payload.title}}</h2>\n    </body>\n</html>","x":720,"y":180,"wires":[["93a4fdc4.d0c6e"]]},{"id":"df8ee7cd.97cd48","type":"function","z":"ad715e3a.f672","name":"SQL Query","func":"msg.topic = \"SELECT * FROM book WHERE id='D0001'\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":270,"y":180,"wires":[["5184c74e.4cd068"]]},{"id":"93a4fdc4.d0c6e","type":"http response","z":"ad715e3a.f672","name":"","x":890,"y":180,"wires":[]},{"id":"5184c74e.4cd068","type":"mysql","z":"ad715e3a.f672","mydb":"51c3503.61936b","name":"","x":420,"y":180,"wires":[["dee38252.c0fb5"]]},{"id":"dee38252.c0fb5","type":"function","z":"ad715e3a.f672","name":"Get Book","func":"var id = msg.payload[0].id;\nvar title = msg.payload[0].title;\nmsg.payload = {};\nmsg.payload.id = id;\nmsg.payload.title = title;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":560,"y":180,"wires":[["ae181702.047de8"]]},{"id":"b6052e75.054cb","type":"comment","z":"ad715e3a.f672","name":"12-3-2","info":"","x":100,"y":40,"wires":[]},{"id":"6fd300bd.5de2","type":"comment","z":"ad715e3a.f672","name":"12-3-2a","info":"","x":90,"y":140,"wires":[]},{"id":"51c3503.61936b","type":"MySQLdatabase","name":"","host":"127.0.0.1","port":"3306","db":"mybook","tz":"","charset":"UTF8"}]

沒有留言:

張貼留言

113 學年度第 1 學期 RFID應用課程 Arduino程式

113 學年度第 1 學期 RFID應用課程 Arduino程式 https://www.mediafire.com/file/zr0h0p3iosq12jw/MFRC522+(2).7z/file 內含修改過後的 MFRC522 程式庫 (原程式有錯誤) //定義MFRC522...