var server = require('webserver').create();
var port = 9091;
var getPage = function(url, callback) {
var page = require('webpage').create();
page.open(url, function() {
setTimeout(function() {
page.evaluate(function() {
$('meta[name=fragment], script').remove()
});
callback(page.content);
page.close();
}, 200);
});
};
server.listen(port, function(request, response) {
response.headers = {
'Content-Type': 'text/html'
};
var regexp = /_escaped_fragment_=(.*)$/;
var fragment = request.url.match(regexp);
var url = 'http://vestfin.com/#!' + decodeURIComponent(fragment[1]);
getPage(url, function(content) {
response.statusCode = 200;
response.write(content);
response.close();
})
});