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.
postman_collection
manifest.yml
package.json
readme.md
server.js

readme.md

Simple forwarding server

In case of that a cors problem using Node-RED as REST server can not be fixed. I wrote a simple sample REST forwarding server, which has cors enabled. As a simple webapp you can use the static webapp in this git

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

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

Note: Static sample web page uses the 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_forward_server
npm install
npm start

Usage

I expect you have a running Node-RED instance on IBM Cloud.

Use postman or the simple webapp in this github project (simple_web_app/readme.md).

postman

I created a sample for postman. You can import the postman collection and test the forward server.

Sample output when postman is used:

npm start
> simple_forward_server@1.0.0 start
> node server.js

forward server is running
URL: 
 https://hackathon-node-red-tsuedbro.eu-de.mybluemix.net/getData
send request
in request 

Success: 
 {"name":"hackathon","cloud":"ibm","message":"hello world"}

simple webapp

Open the static web page

You can’t perform that action at this time.