# From Node.js code to Node-Red flows

**URL:** <https://discourse.nodered.org/t/from-node-js-code-to-node-red-flows/86393>\
**Category:** General\
**Created:** [13 March 2024 08:26 UTC](https://discourse.nodered.org/t/from-node-js-code-to-node-red-flows/86393 "2024-03-13T08:26:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![MagicJF](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/magicjf/32/87593_2.png) [@MagicJF](https://discourse.nodered.org/u/MagicJF)\
**Post date:** [13 March 2024 08:26 UTC](https://discourse.nodered.org/t/from-node-js-code-to-node-red-flows/86393/1 "2024-03-13T08:26:56Z")

</div>

Hello,

I do have a server coded in Node.js with thousands of lines of code and I would like to have it working on Node-Red flows instead.

Is there an automatic way to do the migration?

I suspect I could benefit from GhatGPT by copying and pasting fragments of code to achieve the migration, but not sure if that is a good idea at all.

Suggestions and Inspiration is appreciated.

---

<div class="post-metadata">

**Author:** ![joepavitt](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/joepavitt/32/59722_2.png) [@joepavitt](https://discourse.nodered.org/u/joepavitt)\
**Post date:** [13 March 2024 13:46 UTC](https://discourse.nodered.org/t/from-node-js-code-to-node-red-flows/86393/2 "2024-03-13T13:46:57Z")

</div>

What kind of server? There are too many combinations/permutations of NodeJS server and code structures to be sure it could be _automated_.

ChatGPT is fairly good with Node-RED, so may be able to at least get your started with the base API structure in place, etc.

There is also the Node-RED `function` node, which supports NodeJS code, and will run it's contents, but if you're firing up Express endpoints, etc. for example, then best to use the core `http-in`/`http-out` nodes.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [17 March 2024 21:55 UTC](https://discourse.nodered.org/t/from-node-js-code-to-node-red-flows/86393/3 "2024-03-17T21:55:31Z")

</div>

> [@MagicJF](#):
>
> I do have a server coded in Node.js with thousands of lines of code and I would like to have it working on Node-Red flows instead.

I think it would help if you explained a little about why you want to do this?

There are alternatives that might work equally well or better in some circumstances and it is likely that your already coded micro-server app is already more efficient than it would be if converted to Node-RED.

Have you considered instead, creating an interface between your server and Node-RED? The specifics of how best to do that depend a lot on what you are trying to achieve - hence the initial question.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [15 June 2024 21:55 UTC](https://discourse.nodered.org/t/from-node-js-code-to-node-red-flows/86393/4 "2024-06-15T21:55:37Z")

</div>

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