I put together a very simple form and post to learn this feature in node-red, but hitting a wall
The form displays, and when I enter data and click submit, I get;
URL http://localhost:1880/"posts?"title"=No&"post"=hel
Page content is just "Cannot GET /%E2%80%9Dposts%E2%80%9D"
I am pretty certain the URL is malformed, but cannot figure out why
[
{
"id": "84c0c0cf.3e61c8",
"type": "http in",
"z": "5fa1c90f.a6ce48",
"name": "Get posts",
"url": "/posts",
"method": "get",
"upload": false,
"swaggerDoc": "",
"x": 131,
"y": 226,
"wires": [
[
"96c02e55.4ad028"
]
]
},
{
"id": "96c02e55.4ad028",
"type": "template",
"z": "5fa1c90f.a6ce48",
"name": "Web Page Template",
"field": "payload",
"fieldType": "msg",
"format": "handlebars",
"syntax": "mustache",
"template": "<!DOCTYPE html>\n<html lang=”en”>\n <head>\n </head>\n <body>\n <h1>My Micro Blog</h1>\n <form action=”posts” method=”post”>\n <label for=”title”>Title</label>\n <input type=”text” class=”form-control” name=”title” placeholder=”Title…” />\n <label for=”post”>Post Content</label>\n <input type=”text” class=”form-control” name=”post” placeholder=”Say something…” />\n <button type=”submit” class=”btn btn-default”>Submit</button>\n </form>\n <div>\n {{{#payload}}}\n <div class=”post”>\n <h3>{{{title}}}</h3>\n <p>{{{post}}}</p>\n </div>\n {{{/payload}}}\n </div>\n </body>\n</html>",
"output": "str",
"x": 505.5,
"y": 229,
"wires": [
[
"b16699bd.980378"
]
]
},
{
"id": "b16699bd.980378",
"type": "http response",
"z": "5fa1c90f.a6ce48",
"name": "Send Template",
"statusCode": "",
"headers": {},
"x": 722,
"y": 229,
"wires": []
},
{
"id": "74c7f6b3.310138",
"type": "http in",
"z": "5fa1c90f.a6ce48",
"name": "Get response posts",
"url": "/posts",
"method": "post",
"upload": false,
"swaggerDoc": "",
"x": 177,
"y": 406,
"wires": [
[
"3bb65c91.5133ec"
]
]
},
{
"id": "22808a2d.a6537e",
"type": "function",
"z": "5fa1c90f.a6ce48",
"name": "Check status code",
"func": "\nmsg.headers = {\n \"Location\" : \"http://localhost:1880/posts\"\n};\nmsg.statusCode = 302;\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"x": 471,
"y": 395,
"wires": [
[
"2b7dcf67.4af288"
]
]
},
{
"id": "2b7dcf67.4af288",
"type": "http response",
"z": "5fa1c90f.a6ce48",
"name": "",
"statusCode": "",
"headers": {},
"x": 699,
"y": 404,
"wires": []
},
{
"id": "3bb65c91.5133ec",
"type": "debug",
"z": "5fa1c90f.a6ce48",
"name": "",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 698,
"y": 473,
"wires": []
},
{
"id": "63937066.b6ec58",
"type": "mysql",
"z": "5fa1c90f.a6ce48",
"mydb": "ab27ce93.b52ad8",
"name": "Node-Red",
"x": 308.5,
"y": 484,
"wires": [
[]
]
},
{
"id": "ab27ce93.b52ad8",
"type": "MySQLdatabase",
"z": "",
"host": "127.0.0.1",
"port": "3306",
"db": "nodered",
"tz": ""
}
]