mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-01-25 17:46:18 +00:00
serve index for all other pages (/builds/:id, etc)
This commit is contained in:
parent
5c63dea013
commit
5a9bae3853
8
app.js
8
app.js
@ -18,7 +18,9 @@ var app = new EventEmitter(),
|
||||
logger = libLogger('app'),
|
||||
httpApi = require('./httpApi')(app);
|
||||
|
||||
var staticServer = new nodeStatic.Server(path.join(__dirname, 'static'));
|
||||
var staticPath = path.join(__dirname, 'static'),
|
||||
staticServer = new nodeStatic.Server(staticPath);
|
||||
|
||||
var server = http.createServer(function(req, res) {
|
||||
if (req.url.indexOf('/api/') === 0) {
|
||||
return httpApi(req, res);
|
||||
@ -36,7 +38,9 @@ var server = http.createServer(function(req, res) {
|
||||
res.write(index({env: env}));
|
||||
res.end();
|
||||
} else {
|
||||
staticServer.serve(req, res);
|
||||
// serve index for all other pages (/builds/:id, etc)
|
||||
fs.createReadStream(path.join(staticPath, 'index.html'))
|
||||
.pipe(res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user