share workspace files as static

This commit is contained in:
oleg 2015-12-08 22:09:46 +03:00
parent da5f215629
commit d68d679210
2 changed files with 9 additions and 2 deletions

View File

@ -40,7 +40,7 @@ content
## Feature requests
* should write at the end of build console out that build is done (or error)
* share workspace files at static
* ~~share workspace files at static~~
* "clear workspace" button
* show more builds button (or infinity scroll) on start page
* hide console output by default (when go on completed build page you scroll

9
app.js
View File

@ -19,13 +19,18 @@ var app = new EventEmitter(),
httpApi;
var staticPath = path.join(__dirname, 'static'),
staticServer = new nodeStatic.Server(staticPath);
staticServer = new nodeStatic.Server(staticPath),
staticDataServer;
var server = http.createServer(function(req, res) {
if (req.url.indexOf('/api/') === 0) {
return httpApi(req, res);
}
if (new RegExp('^/projects/(\\w|-)+/workspace').test(req.url)) {
return staticDataServer.serve(req, res);
}
if (req.url.indexOf('/data.io.js') === -1) {
if (/(js|css|fonts)/.test(req.url)) {
staticServer.serve(req, res);
@ -143,6 +148,8 @@ Steppy(
// path to root dir (with projects, builds etc)
app.config.paths.data = path.join(process.cwd(), 'data');
staticDataServer = new nodeStatic.Server(app.config.paths.data);
app.config.paths.projects = path.join(app.config.paths.data, 'projects');
app.config.paths.db = path.join(app.config.paths.data, 'db');
app.config.paths.preload = path.join(app.config.paths.data, 'preload.json');