Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When httpNodeRoot is not slash terminated string, dash-link-button does not work #319

Closed
cosmo0920 opened this issue Dec 14, 2017 · 1 comment
Labels

Comments

@cosmo0920
Copy link

cosmo0920 commented Dec 14, 2017

TL;DR

When I set httpNodeRoot such as /api which is not slash terminated string, dash-link-button does not work.

reprodicible step and code

package.json
{
  "name": "my-node-red-project",
  "version": "0.0.1",
  "description": "An example project to integrate Node-RED into express.",
  "main": "\"\"",
  "dependencies": {
    "node-red": "^0.17.5",
    "node-red-dashboard": "^2.6.2",
    "express": "^4.16.2"
  },
  "devDependencies": {},
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [
    "node-red"
  ],
  "author": "",
  "license": "MIT"
}
app.js
var http = require('http');
var express = require("express");
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);

// Create the settings object - see default settings.js file for other options
var settings = {
  httpAdminRoot:"/red",
  httpNodeRoot: "/api",
  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);

// Start the runtime
RED.start();

and then, access http://localhost:8000/red/ with web browser and click dash-link-button.

I got 404.

nod-red-dashboard-issue

Expected result

I can access with /api/ui when clicking dash-link-button.

@dceejay dceejay changed the title When httpNodeRoot is not slash terminated srting, dash-link-button does not work When httpNodeRoot is not slash terminated string, dash-link-button does not work Dec 14, 2017
@dceejay dceejay added the bug label Dec 14, 2017
@dceejay dceejay added this to Work in Progress - on master, maybe not on npm. in Dashboard - Things to do Dec 14, 2017
@cosmo0920
Copy link
Author

Thank you for quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants