Why node.js server in Visual Studio for Azure is created differently? -
i ran strange problem in azure project seems related how server created. project created using basic azure node.js express 4 application
template in visual studio 2013 ultimate. after struggle, project runs fine locally, until hit browser's refresh button never comes back.
the project created in webstorm , didn't have problem. figured, difference between them minimal: in webstorm, used:
var server = http.createserver(app); server.listen(process.env.port, process.env.ip);
but in visual studio, used (created template in www file):
app.set('port', process.env.port || 3000); var server = app.listen(app.get('port'), function() { console.log('express server listening on port ' + server.address().port); });
when replace webstorm version, seems work fine again. can explain why?
by way, in app, i'm not using node views. instead, i'm using:
app.set("view options", { layout: false }); app.all('*', function (req, res, next) { res.sendfile(__dirname + "/public/index.html"); // send index.html other files support html5mode });
could related problem?
Comments
Post a Comment