SPDFramework Web Page

The SPDFramework Web Page is a Web Site Framework developed by Speed Junior. The main idea is proposed a Framework using NodeRED to develop a fully Web Site Application.

The SPDFramework uses a Page Switch that choose witch page will be open and construct part by part of the Web Site. The SPDFramework also use an action switch to coordinate the actions that will be performed according with the URL action select. Ex: home?action=add.

This is just a beginning of the development. The idea is create a fully application with session variables, login, forms, DB record, DB retrieve, etc.

[{"id":"e4af19e4.31eac","type":"template","z":"f3ae6ea5.006dc8","name":"Header","field":"payload.header","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<header>\n\t<h1>NodeRED Sample Application</h1>\n\t<nav>\n\t\t<ul>\n\t\t\t<li class=\"dropdown\"><a href=\"/home\">Home</a>\n\t\t\t    <ul class=\"dropdown-content\">\n\t\t\t        <li><a href=\"/home?action=list\">List</a></li>\n\t\t\t        <li><a href=\"/home?action=save\">Save</a></li>\n\t\t\t    </ul>\n\t\t\t</li>\n            <li class=\"dropdown\"><a href=\"/monitor\">Monitor</a>\n                <ul class=\"dropdown-content\">\n                    <li><a href=\"/monitor?action=list\">List</a></li>\n                    <li><a href=\"/monitor?action=add\">Add</a></li>\n                </ul>\n            </li>\n            <li><a href=\"/contact\">Contact</a></li>\n            <li><a href=\"/about\">About</a></li>\n\t\t</ul>\n\t</nav>\n</header>","x":297,"y":220,"wires":[["4676a0b6.33ce6"]]},{"id":"6dcd5e0.1af1624","type":"http in","z":"f3ae6ea5.006dc8","name":"","url":"/home","method":"get","swaggerDoc":"","x":102,"y":110,"wires":[["ccc37620.dfcf48"]]},{"id":"36582ab2.3a8836","type":"http response","z":"f3ae6ea5.006dc8","name":"","x":185,"y":888,"wires":[]},{"id":"76d0d830.44b4d","type":"template","z":"f3ae6ea5.006dc8","name":"Home","field":"payload.section","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<section class=\"courses\">\n<a href=\"/home\">\n\t<article>\n\t\t<figure>\n\t\t\t<img src=\"images/bok-choi.jpg\" alt=\"Home\" />\n\t\t\t<figcaption>Home</figcaption>\n\t\t</figure>\n\t\t<hgroup>\n\t\t\t<h2>Home Page</h2>\n\t\t\t<h3>This is my home page</h3>\n\t\t</hgroup>\n\t\t<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>\n\t</article>\n</a>\n</section>","x":784,"y":378,"wires":[["4143db86.f2655c"]]},{"id":"64cc9dc3.b08c24","type":"template","z":"f3ae6ea5.006dc8","name":"Monitor","field":"payload.section","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"{{{payload.select}}}\n<section class=\"courses\">\n<a href=\"/Monitor\">\n\t<article>\n\t\t<figure>\n\t\t\t<img src=\"images/teriyaki.jpg\" alt=\"News\" />\n\t\t\t<figcaption>Monitor</figcaption>\n\t\t</figure>\n\t\t<hgroup>\n\t\t\t<h2>Monitor Page</h2>\n\t\t\t<h3>This is the Monitor Page</h3>\n\t\t</hgroup>\n\t\t<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>\n\t</article>\n</a>\n</section>","x":785,"y":506,"wires":[["4143db86.f2655c"]]},{"id":"ee3c7e7c.a7cae8","type":"http in","z":"f3ae6ea5.006dc8","name":"","url":"/monitor","method":"get","swaggerDoc":"","x":102,"y":153,"wires":[["ccc37620.dfcf48"]]},{"id":"140b8463.320e94","type":"switch","z":"f3ae6ea5.006dc8","name":"Page Switch","property":"req._parsedUrl.pathname","propertyType":"msg","rules":[{"t":"eq","v":"/home","vt":"str"},{"t":"eq","v":"/monitor","vt":"str"},{"t":"eq","v":"/contact","vt":"str"},{"t":"eq","v":"/about","vt":"str"}],"checkall":"true","outputs":4,"x":277,"y":353,"wires":[["8ea61720.ef7be8"],["2c60a3f8.89af04"],["577d246c.fa651c"],["3fd1293.0bbb556"]]},{"id":"4143db86.f2655c","type":"template","z":"f3ae6ea5.006dc8","name":"Footer","field":"payload.footer","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<footer>\n\t&copy; 2017 Speed Junior\n</footer>","x":1020,"y":542,"wires":[["f75dcbb1.3a4ab"]]},{"id":"6bdc4f4f.851b18","type":"http in","z":"f3ae6ea5.006dc8","name":"","url":"/contact","method":"get","swaggerDoc":"","x":102,"y":199,"wires":[["ccc37620.dfcf48"]]},{"id":"95535ce9.fb9c8","type":"http in","z":"f3ae6ea5.006dc8","name":"","url":"/about","method":"get","swaggerDoc":"","x":99,"y":250,"wires":[["ccc37620.dfcf48"]]},{"id":"b7bf461a.93ef38","type":"template","z":"f3ae6ea5.006dc8","name":"Contact","field":"payload.section","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<section class=\"courses\">\n<a href=\"/contact\">\n\t<article>\n\t\t<figure>\n\t\t\t<img src=\"images/bok-choi.jpg\" alt=\"Contact\" />\n\t\t\t<figcaption>Contact</figcaption>\n\t\t</figure>\n\t\t<hgroup>\n\t\t\t<h2>Contact Page</h2>\n\t\t\t<h3>This is contact page</h3>\n\t\t</hgroup>\n\t\t<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>\n\t</article>\n</a>\n</section>\n","x":773,"y":656,"wires":[["4143db86.f2655c"]]},{"id":"1393f8c4.d22157","type":"template","z":"f3ae6ea5.006dc8","name":"About","field":"payload.section","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<section class=\"courses\">\n<a href=\"/about\">\n\t<article>\n\t\t<figure>\n\t\t\t<img src=\"images/teriyaki.jpg\" alt=\"About\" />\n\t\t\t<figcaption>About</figcaption>\n\t\t</figure>\n\t\t<hgroup>\n\t\t\t<h2>About Page</h2>\n\t\t\t<h3>This is my about page</h3>\n\t\t</hgroup>\n\t\t<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>\n\t</article>\n</a>\n</section>\n","x":769,"y":710,"wires":[["4143db86.f2655c"]]},{"id":"ccc37620.dfcf48","type":"template","z":"f3ae6ea5.006dc8","name":"CSS","field":"payload.style","fieldType":"msg","format":"css","syntax":"mustache","template":"ul {\n    list-style-type: none;\n    margin: 0;\n    padding: 0;\n    overflow: hidden;\n    background-color: #333;\n}\n\nli {\n    float: left;\n}\n\nli a, .dropbtn {\n    display: inline-block;\n    color: white;\n    text-align: center;\n    padding: 14px 16px;\n    text-decoration: none;\n}\n\nli a:hover, .dropdown:hover .dropbtn {\n    background-color: red;\n}\n\nli.dropdown {\n    display: inline-block;\n}\n\n.dropdown-content {\n    display: none;\n    position: absolute;\n    background-color: #f9f9f9;\n    min-width: 160px;\n    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);\n    z-index: 1;\n}\n\n.dropdown-content a {\n    color: black;\n    padding: 12px 16px;\n    text-decoration: none;\n    display: block;\n    text-align: left;\n}\n\n.dropdown-content a:hover {background-color: #f1f1f1}\n\n.dropdown:hover .dropdown-content {\n    display: block;\n}","x":304,"y":165,"wires":[["e4af19e4.31eac"]]},{"id":"2bedcf9c.9d7ef8","type":"template","z":"f3ae6ea5.006dc8","name":"Page","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<html>\n    <head>\n        <title>NodeRED WebPage Template</title>\n        <style>{{{payload.style}}}</style>\n    </head>\n    <body>\n    <div class=\"wrapper\">\n        {{{payload.header}}}\n        {{{payload.section}}}\n        {{{payload.footer}}}\n    </div>\n    </body>\n</html>","x":186,"y":833,"wires":[["36582ab2.3a8836"]]},{"id":"b66e8859.00fc58","type":"comment","z":"f3ae6ea5.006dc8","name":"NodeRED Web Site SPDFramework","info":"","x":201,"y":66,"wires":[]},{"id":"4676a0b6.33ce6","type":"function","z":"f3ae6ea5.006dc8","name":"Global Settings","func":"global.set('header', msg.payload.header);\nglobal.set('style', msg.payload.style);\nreturn msg;","outputs":1,"noerr":0,"x":308,"y":272,"wires":[["140b8463.320e94"]]},{"id":"f75dcbb1.3a4ab","type":"function","z":"f3ae6ea5.006dc8","name":"Assembly Payload","func":"msg.payload.header = global.get('header');\nmsg.payload.style = global.get('style');\nreturn msg;","outputs":1,"noerr":0,"x":227,"y":770,"wires":[["2bedcf9c.9d7ef8"]]},{"id":"a11b67a4.29fb48","type":"switch","z":"f3ae6ea5.006dc8","name":"monitor action switch","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"list","vt":"str"},{"t":"eq","v":"add","vt":"str"}],"checkall":"false","outputs":2,"x":614,"y":557,"wires":[["8a3cfca1.b7518"],["8f96fd98.5ac7c"]]},{"id":"577d246c.fa651c","type":"switch","z":"f3ae6ea5.006dc8","name":"contact action","property":"req._parsedUrl.query","propertyType":"msg","rules":[{"t":"null"},{"t":"nnull"}],"checkall":"false","outputs":2,"x":526,"y":662,"wires":[["b7bf461a.93ef38"],[]]},{"id":"3fd1293.0bbb556","type":"switch","z":"f3ae6ea5.006dc8","name":"about action","property":"req._parsedUrl.query","propertyType":"msg","rules":[{"t":"null"},{"t":"nnull"}],"checkall":"false","outputs":2,"x":515,"y":720,"wires":[["1393f8c4.d22157"],[]]},{"id":"8ea61720.ef7be8","type":"switch","z":"f3ae6ea5.006dc8","name":"home circuit","property":"req._parsedUrl.query","propertyType":"msg","rules":[{"t":"null"},{"t":"nnull"}],"checkall":"true","outputs":2,"x":504,"y":383,"wires":[["76d0d830.44b4d"],["aebd64b2.832d68"]]},{"id":"2c60a3f8.89af04","type":"switch","z":"f3ae6ea5.006dc8","name":"monitor circuit","property":"req._parsedUrl.query","propertyType":"msg","rules":[{"t":"null"},{"t":"nnull"}],"checkall":"true","outputs":2,"x":509,"y":512,"wires":[["64cc9dc3.b08c24"],["a11b67a4.29fb48"]]},{"id":"aebd64b2.832d68","type":"switch","z":"f3ae6ea5.006dc8","name":"home action switch","property":"payload.action","propertyType":"msg","rules":[{"t":"eq","v":"list","vt":"str"},{"t":"eq","v":"save","vt":"str"}],"checkall":"true","outputs":2,"x":597,"y":437,"wires":[["9538162f.c42a08"],["ba88707f.ac847"]]},{"id":"9538162f.c42a08","type":"template","z":"f3ae6ea5.006dc8","name":"Home - List","field":"payload.section","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<div>\n    <h2>This is my Home - List Action Result</h2>\n</div>","x":802,"y":429,"wires":[["4143db86.f2655c"]]},{"id":"ba88707f.ac847","type":"template","z":"f3ae6ea5.006dc8","name":"Home - Save","field":"payload.section","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<div>\n    <h2>This is my Home - Save Action Result</h2>\n</div>","x":802,"y":463,"wires":[["4143db86.f2655c"]]},{"id":"8a3cfca1.b7518","type":"template","z":"f3ae6ea5.006dc8","name":"Monitor - List","field":"payload.section","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<div>\n    <h2>This is my Monitor - List Action Result</h2>\n</div>","x":815,"y":552,"wires":[["4143db86.f2655c"]]},{"id":"8f96fd98.5ac7c","type":"template","z":"f3ae6ea5.006dc8","name":"Monitor - Add","field":"payload.section","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<div>\n    <h2>This is my Monitor - Add Action Result</h2>\n</div>","x":824,"y":586,"wires":[["4143db86.f2655c"]]}]
epjuniorbr

Flow Info

created 7 months, 3 weeks ago

Node Types

Core
  • comment (x1)
  • function (x2)
  • http in (x4)
  • http response (x1)
  • switch (x7)
  • template (x12)

Tags

  • website
  • fully
  • application
  • html
  • framework
  • web
  • page
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option