Skip to content

Instantly share code, notes, and snippets.

@joeartsea
Created December 9, 2015 07:59
Show Gist options
  • Save joeartsea/65c6aedeb164bfc306ee to your computer and use it in GitHub Desktop.
Save joeartsea/65c6aedeb164bfc306ee to your computer and use it in GitHub Desktop.
Node-REDの画面カスタマイズ方法 ref: http://qiita.com/joeartsea/items/6400e21eefa5a9b44e15
var http = require('http');
var express = require("express");
var settings = require("./settings"); // <- require
var RED = require("node-red");
// Create an Express app
var app = express();
// Add a simple route for static content served from 'public'
app.use("/",express.static("public"));
// Create a server
var server = http.createServer(app);
// 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);
// Start the runtime
RED.start();
<link rel="stylesheet" href="style.css" />
<p class="test">Node-REDを組込んだExpressアプリケーション</p>
module.exports = {
httpAdminRoot:"/red",
httpNodeRoot: "/api",
functionGlobalContext: { } // enables global context
};
.test { color: red; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment