Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
public
manifest.yml
package.json
readme.md
server.js

readme.md

Simple web app

In case of that a cors problem using Node-RED as REST server can not be fixed. I wrote a simple sample WebApp to access REST forward server, which has cors enabled.

var cors = require("cors"); // Cors
app.use(cors());

Related blog post: cors and Node-RED using a simple forwarding server

Note: Static sample web page uses as a starting point code from stackoverfollow.

Basic flow

simple diragram

Local installation

git clone https://github.com/thomassuedbroecker/hackathons_and_node-red.git
cd /hackathons_and_node-red/simple_web_app
npm install
npm start

Usage

npm start

> @ start /hackathons_and_node-red/simple_web_app
> node server.js

Listening on port (3001)

Open http://localhost:3001 in the browser and insert some text in the edit box.

You should the you response like this:

  • WebApp webpage output

simple-web-app-output-html

  • Forward server console output

simple-web-app-output-forward-server

  • Node-RED output

simple-web-app-node-red-output-html

You can’t perform that action at this time.