background
Recently, readers always come to me asking how to customize the development of Node-RED. They want to do some custom development based on their own projects.
For example, adjust the layout of Node-RED, theme color, and add some buttons. Or integrate some other functions into it.
In the next few articles, we will analyze the source code of NODE-RED.
The core code of NODE-RED is mainly in packages/node_modules/@node-red
this directory.
According to the latest version, there are 6 subdirectories under this directory, which are:
- editor-api editor backend code
- editor-client editor front-end code
- nodes default installed nodes
- registry plugin, library, node registration management
- runtime Runtime entry, also the entry of node-red
- util auxiliary tools
This article first explains the function and important source code of the editor-api directory. It is convenient for developers to quickly understand and find the corresponding files during development.
editor-api
This directory stores the backend api service used to support the editor-client function.
It is an application launched using express. Depends on @node-red/util and @node-red/editor-client.
The entry point for this module is./lib/index.js
App initialization code
function init(settings