I setup this simple node server bellow:
'use strict';
var lactate = require('lactate'),
http = require('http'),
port = 8001,
root = '/var/www/apps';
var options = {
root: root,
from: '',
not_found: root + '/404.html',
subdirs: true,
debug: true
};
var files = lactate.dir(root, options);
var server = new http.Server();
server.addListener('request', function(req, res) {
if (req.url === '/') {
files.serve('index.html', req, res);
} else {
files.serve(req, res);
}
});
server.listen(port);
'use strict';
var bouncy = require('bouncy');
var server = bouncy(function (req, res, bounce) {
if (req.headers.host === 'my-app') {
bounce(8001);
}
else {
res.statusCode = 404;
res.end('no such host');
}
});
server.listen(8000);
node server.js
node route.js
If a RUN just the server.js ALL works fine, but if i run it trough route.js the app keeping loop trying to download some sources(images) and never finish it.
Can i use bouncy with lactate? What am i doing wrong?
Lactate.js source: https://github.com/Weltschmerz/Lactate *Bouncy.js source: https://github.com/substack/bouncy*
Thank you very much!