Created
March 9, 2020 19:04
-
-
Save beevelop/fddca683c4081eef295b680bcebf18c9 to your computer and use it in GitHub Desktop.
Node-RED embedded (standalone)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var RED = require("node-red"); | |
var importedFlows = require('./flows.json') | |
const path = require('path'); | |
// Create the settings object - see default settings.js file for other options | |
var settings = { | |
httpNodeRoot: false, | |
httpAdminRoot: false, | |
userDir: path.join(__dirname, ".nodered"), | |
functionGlobalContext: {} | |
}; | |
const init = async () => { | |
// Initialise the runtime with a server and settings | |
RED.init(null, settings); | |
await RED.start(); | |
let foo = await RED.runtime.flows.setFlows( | |
{ | |
flows: { flows: importedFlows }, | |
deploymentType: 'flows' | |
} | |
) | |
console.log(await RED.runtime.flows.getFlows()) | |
} | |
init() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment