1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Add dedicated route for editor index.html

This commit is contained in:
Nick O'Leary 2015-04-08 21:29:55 +01:00
parent e1dd8cf2ab
commit e1f0969957
3 changed files with 24 additions and 5 deletions

View File

@ -42,9 +42,9 @@ function init(adminApp,storage) {
// Editor // Editor
if (!settings.disableEditor) { if (!settings.disableEditor) {
var editorApp = express(); var editorApp = express();
editorApp.get("/",ui.ensureSlash); editorApp.get("/",ui.ensureSlash,ui.editor);
editorApp.get("/icons/:icon",ui.icon); editorApp.get("/icons/:icon",ui.icon);
editorApp.use("/",ui.editor); editorApp.use("/",ui.editorResources);
adminApp.use(editorApp); adminApp.use(editorApp);
} }

View File

@ -55,5 +55,8 @@ module.exports = {
res.sendfile(defaultIcon); res.sendfile(defaultIcon);
} }
}, },
editor: express.static(__dirname + '/../../public') editor: function(req,res) {
res.sendfile(path.resolve(__dirname + '/../../public/index.html'));
},
editorResources: express.static(__dirname + '/../../public')
}; };

View File

@ -152,8 +152,24 @@ describe("ui api", function() {
done(); done();
}); });
}); });
});
describe("editor ui resource handler", function() {
before(function() {
app = express();
app.use("/",ui.editorResources);
});
it('serves the editor resources', function(done) {
request(app)
.get("/favicon.ico")
.expect(200)
.end(function(err,res) {
if (err) {
return done(err);
}
done();
});
});
}); });