Git Product home page Git Product logo

node-red-in-openshift's Introduction

Node-RED Deployment in Openshift

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).

user-registration.json developed API

resource name: "/user" has a few method (and a few flows) which emulates create, get and delete user in some system

Create user http: post, path /user

  • 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
}

Get user by id http: get, path /user

  • Request:

Request as a parameter in url

/user?id=199
  • Response: Status Code: 200
{"id":"199","fullname":"Petro Petrenko","phone":"222-33-44"}

Delete user by id http: delete, path /user

  • Request:

Request as a parameter in url

/user?id=199
  • Response:

Status Code: 200

{
  "ok": true,
  "id": "199",
  "message": "user deleted"
}

Error messages

Status Code: 422

{ "errcode": "ValueRangeError", "message": "Propery [id] must be between 100 and 200" }

Run on your laptop

  1. run
        git clone https://github.com/pavlo-shcherbukha/node-red-in-openshift.git
  1. run user-registration.json in development mode
npm run dev

Then go to http://localhost:1880

  1. 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

Deploy on Openshift

  • 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

node-red-in-openshift's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.