
This is a settings in the settings.js file.
NODE HTTP CLIENT FULL
You could also use the full pathname /home/pi/.node-red/node-red-static/testpage.htm.Īlthough it makes sense for the URL and page name to match they don’t need to.įor this to work we need to place our file in the static content folder and set the location of the static content folder.

My folder structure is /home/pi/.node-red/node-red-static/ and so for the file node I enter node-red-static/testpage.htm. However when reading the file I need to specify the path from the node-red root which is. The root folder for my static content is called node-red-static and so the file (web page) needs to be placed in this folder. You should pay attention to the file name path. In the previous flow our web page contents were inserted into the payload and so to do this with a file store on disk we read a file into the payload as shown in the above flow. Note that the contents are returned in the payload. The contents of the template is an HTML page like the simple one shown below: Returning a Web Page using the Template Node. To do this we can either create a page and store it on disk or use a template node. Now if we test using a web browser it works but we don’t see anything in the browser. We can accomplish this by simply wiring the output of the http-in node to the http-response node. To send a response back to the browser we need to use the http-response node. This is because the browser is expecting a response but doesn’t get one. You will see the request in the debug node, but the browser will show an error. If we start using the simple flow shown below where we pass the output of the http-in node to a debug node and test this using a web browser. If you look at the screen shot below the http-in node will accept a get request on the URL /webserver. To do this we first configure the http-in node as shown in the screen shot below: To illustrate how you use it we will configure a simple web server to serve web pages from the base url of myserver. GET is most commonly used request type and was the only request type in the Original HTTP specification.Ī list of request types and their function is here.
NODE HTTP CLIENT PATCH
The node supports the GET,POST,PUT,DELETE and PATCH methods. The http-in node is the web server, and needs to be configured to accept a URL request.

