Skip to content
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

Cannot GET / error (express 3.0) #3

Open
asmcad opened this issue Jan 2, 2014 · 4 comments
Open

Cannot GET / error (express 3.0) #3

asmcad opened this issue Jan 2, 2014 · 4 comments

Comments

@asmcad
Copy link

asmcad commented Jan 2, 2014

app.use( require('express-subdomain-handler')({ baseUrl: 'node.localhost', prefix: 'subdomain', logger: true }) );

app.get('/subdomain/mysubdomain/',some.somert)

mysubdomain.node.localhost:1337 or mysubdomain.localhost:1337

doesn'T work either. what am i doing wrong?

is it something with the version of expressjs?

@wilsonpage
Copy link
Owner

When you say "doesn't work" it's hard to diagnose the problem. The localhost domain will not accept 'wildcard' subdomains by default. You will have to add each full host to your /etc/hosts file, some thing like:

127.0.0.1 mysubdomain.node.localhost
127.0.0.1 mysubdomain.localhost

@asmcad
Copy link
Author

asmcad commented Jan 2, 2014

Thanks for quick reply and sorry for not detailed explanation but there was not much code. It is just standard expressjs project.

app.use( require('express-subdomain-handler')({ baseUrl: 'localhost', prefix: 'subdomain', logger: true}) );

app.get('/subdomain/:mysubdomain/thepage', function(req, res, next){
res.send("some text");
console.log(req.params.mysubdomain);
});

and my host file:

127.0.0.1 mysubdomain.node.localhost
127.0.0.1 mysubdomain.localhost

When i try this page : http://mysubdomain.localhost:1337/thepage

I get : Cannot GET /thepage

Is there something wrong here that i don't see?

@wilsonpage
Copy link
Owner

What version of Express are you using? I wrote this a long time ago for Express 2.0. I have not tried it in Express 3.0. I'm afraid I don't have the time to look into this further, but I would recommend throwing some console.log() statements around to try to identify the problem.

@asmcad
Copy link
Author

asmcad commented Jan 3, 2014

I am using Express 3.0. I'll debug it an see what happens. Thanks.

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

2 participants