Connect website with node red

How can i connect node red with a website. note: the website and node red will run independent.

I want to use commands from the website to change rules for data output.

You can create endpoints (http in & out nodes) in node red that you can call from the website.

You can use http request nodes to request (POST / GET) to call from node-red to your website's server.

Search the flow library for examples.

1 Like

Thanks mate :slight_smile:

You can also use uibuilder as the front-end can be run from a separate web server if you want and you can link to the Node-RED server over websockets.

didnt get the cli to work, didnt find much material on it so gave uibuilder up.

There isn't much documentation on using the front-end from another server because nobody has asked for it. :wink:

no i get that xD but on how to use cli with uibuilder. atleast i didnt undertstand how to do it

Do you mean the VueJS CLI?

If so and if you are using your own web server (rather than Node-RED) to deliver the front-end, then all you need to do is ensure that you include the appropriate libraries including the uibuilderfe.js library which you could obtain from the Node-RED server or you could copy it to your own server. When you build your VueJS app code using webpack, the uibuilderfe library will be included with everything else.

Really, the only differences when using your own web server are:

  • You need to correct any URL's if using the default template code

  • You need to manually specify the Socket.IO channel and URL of the Socket.IO client when starting up the uibuilder front-end:

    // Param 1 is the Socket.IO channel name which should be <httpNodeRoot>/<url>
    // <url> is the url setting in your uibuilder node's settings panel.
    // <httpNodeRoot> will just be "/" unless you've changed that property in settings.js
    uibuilder.start('<uibuilder url setting>', '<path to socket.io client>/socket.io')
    
  • You can't edit your front-end code in Node-RED's Editor of course

  • You will want to choose whether you want Node-RED to serve the front-end code for other libraries (Vue, bootstrap, etc) or whether you want to serve that code from your own web server (which may be slightly more secure).

I'm always happy to go through any details.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.