Is it possible to let node-red edit discreted parts of the application?

I have a express app for providing backend restful API.

index.js :slight_smile:

const express = require('express')

const app = express()

// add 
app.get('/hello', (req, res) => {

  // logic steps
  let a = 'hello,'
  let b = 'world!'
  let c = a + b


app.get('/foo', (req, res) => {

  // logic steps
  let data = handlerFoo(req)


app.get('/bar', (req, res) => {

  // logic steps
  let data = handlerBar(req)


function handlerFoo(req) {
  // ... 

function handlerBar(req) {
  // .... 

app.listen(3000, () => {
  console.log(`Example app listening on port 3000}`)

is it possible to use node-red to edit the handler function? I mean use node-red to write the logic steps for all handlers, the handlerFoo , handlerBar implements by node-RED.

If you are asking whether Node-RED can host a restful API similar to what you have written in your code, then the answer is yes.

This example in the cookbook shows how to setup an HTTP endpoint in Node-RED: Create an HTTP Endpoint : Node-RED

I updated my post, please check it, I only want the node-red to implement one step (function) in a HTTP request-response flow.

You can embed Node-RED into your app as described here: Embedding into an existing app : Node-RED

That will allow Node-RED to handle any requests that your own routes don't cover - assuming you have the flow defined in Node-RED to handle the route.

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