forked from node-red/node-red
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexternalRun.coffee
38 lines (28 loc) · 958 Bytes
/
externalRun.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
http = require('http')
express = require("express")
RED = require("./red/red")
# Create an Express app
app = express()
# Add a simple route for static content served from 'public'
app.use("/",express.static("public"))
# Create a server
server = http.createServer(app)
# Create the settings object - see default settings.js file for other options
settings = {
httpAdminRoot:"/red",
httpNodeRoot: "/api",
userDir:"./../weaver-build/client/flows/.nodered/",
flowFile:"flows.json",
functionGlobalContext: { } # enables global context
}
# Initialise the runtime with a server and settings
RED.init(server,settings)
# Serve the editor UI from /red
app.use(settings.httpAdminRoot, RED.httpAdmin)
# Serve the http nodes UI from /api
app.use(settings.httpNodeRoot, RED.httpNode)
server.listen(8000)
RED.api.theme.context().page.title = "Node-red Weaver"
RED.api.theme.context().header.title = "Node-red Weaver"
# Start the runtime
RED.start()