Skip to content

Question: Why 'grunt serve' binds to localhost host ONLY? #1114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
verrol opened this issue Jul 30, 2015 · 5 comments
Closed

Question: Why 'grunt serve' binds to localhost host ONLY? #1114

verrol opened this issue Jul 30, 2015 · 5 comments

Comments

@verrol
Copy link

verrol commented Jul 30, 2015

I am new to Angular-fullstack, but I have used a number of other generators to get here. Why is it, that with AFS, I can't do 'grunt serve' and then load the app from another computer in my network?

When I run nmap from another host to see which ports are opened on the computer where my app is running. Port 9000 doesn't show up, even though the browser on the computer can certainly use it.

I then modified the development env to use my computer IP address, the one I get from the router. It builds, port 9000 is visible from outside, but it doesn't work.

Neither too does 'grunt serve:dist' work even on the localhost. I get a number of 404 error as the browser tries to fetch the page from localhost.

I guess I am missing something simple. But I never had any of these problems with the other generators, but I really would like to use AFS instead of MEAN.js.

I would appreciate any pointer on this issue or steps to fix. Oh, I did some googling and saw others have had the same problem.

Thanks.

.v

PS: If this was done intentionally, why? Since it prevents users from testing on multiple devices during development.

@Awk34
Copy link
Member

Awk34 commented Jul 31, 2015

I do not believe there is anything from the generator preventing you from connecting from a different computer on your LAN.

@kingcody
Copy link
Member

@verrol are you using the latest version of the generator (2.1.1)? If not perhaps #1080 might solve your issue.

@verrol
Copy link
Author

verrol commented Aug 1, 2015

@kingcody Thanks for the pointer. I have the latest and I checked config/environment/index.js. I have that change uses 'localhost'. It still doesn't work for me. Only removing the host/ip works.

May be it is my network or computer environment. I tried this simple example and I could reproduce the problem, with and without host/ip. It certainly seems for me anyway, that .listen() doesn't work with host/ip.

Example code:

server.js:

var app = require('express')();
var server = require('http').Server(app);

var port = 9001;

server.listen(port, function(){
console.log('Express server listening on %d port', port);
});

app.get('/', function (req, res) {
res.sendFile(__dirname + '/index.html');
});

@kingcody
Copy link
Member

@verrol do you still experience the issue with the current 3.0.0-rc5 release?

@Awk34
Copy link
Member

Awk34 commented Sep 13, 2015

Closed due to inactivity.

@Awk34 Awk34 closed this as completed Sep 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants