This repo contains example how to organise development and deployment process Node-RED application
There are two flows:
- user-registration.json contains 3 http methods which emulates create, get and delete user in some system.
- loader.json contains 3 flows which are invoce http methods from user-registration.json after time period (10 sec).
resource name: "/user" has a few method (and a few flows) which emulates create, get and delete user in some system
- Request:
{"username": "user1",
"fullname": "piter buter",
"phone": "222-33-44"
}
- Response: Status Code: 200
{
"user_params": {
"username": "user1",
"fullname": "piter buter",
"phone": "222-33-44"
},
"user_id": "151",
"ok": true
}
- Request:
Request as a parameter in url
/user?id=199
- Response: Status Code: 200
{"id":"199","fullname":"Petro Petrenko","phone":"222-33-44"}
- Request:
Request as a parameter in url
/user?id=199
- Response:
Status Code: 200
{
"ok": true,
"id": "199",
"message": "user deleted"
}
Status Code: 422
{ "errcode": "ValueRangeError", "message": "Propery [id] must be between 100 and 200" }
- run
git clone https://github.com/pavlo-shcherbukha/node-red-in-openshift.git
- run user-registration.json in development mode
npm run dev
Then go to http://localhost:1880
- run loader.json
Before you need run user-registration.json in the test mode, then run loader.json in development mode, because of dependency so:
# run user-registration.json in test mode.
# will be accessed on http:/localhost:8080/
npm run test
# run loader.json in develpment mode
# will be accessed on http:/localhost:1880/
npm run devloader
-
You have to reserve Red Hat OpenShift sendbox
-
Prepare login CMD file
-
Create github secret in case of private repository
-
Input correct data in
- 1-user-reg_srvc-process.cmd - deployment for user-registration.json
- 2-loader_srvc-process.cmd - deployment for loader.json
- 1-route-user-reg-process.cmd - router for user-registration.json
- 2-route-loader-process.cmd - router for loader.json
-
run
- 1-user-reg_srvc-process.cmd - deployment for user-registration.json
- 2-loader_srvc-process.cmd - deployment for loader.json
- 1-route-user-reg-process.cmd - router for user-registration.json
- 2-route-loader-process.cmd - router for loader.json