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

Wildcard subdomain routing? #55

Closed
hockeyst opened this issue Nov 25, 2013 · 6 comments
Closed

Wildcard subdomain routing? #55

hockeyst opened this issue Nov 25, 2013 · 6 comments

Comments

@hockeyst
Copy link

Can partial.js organize wildcard subdomain routing?

Ror example send *.website.debug to subdomain() function in default controller?

@petersirka
Copy link
Collaborator

Hi @hockeyst,

// ONLY:
// http://subdomain.website.debug/
framework.route('[subdomain]/', subdomain);

// http://eshop.website.debug/
framework.route('[eshop]/', subdomain);

// http://blog.website.debug/
framework.route('[blog]/', subdomain);

// http://eshop.website.debug/
// http://blog.website.debug/
framework.route('[eshop,blog]/', subdomain);

// ALL:
// http://*.website.debug/
// http://website.debug/
framework.route('/', root);

// ONLY:
// http://website.debug/contact/
framework.route('[]/contact/', contact);

I fixed [www] from routing of subdomain (https://github.com/petersirka/partial.js/blob/master/changes.txt#l41)
Do you understand?

@petersirka
Copy link
Collaborator

I recommend to run subdomain as a next node.js app.

@hockeyst
Copy link
Author

Yes, i understand! Thanks! But i meant wildcard subdomain as route parameter, for example:

// ALL:
// http://*.website.debug/
framework.route('{wildcard}/', subdomain);

function subdomain(wildcard) {
        wildcard = wildcard || '';
        this.plain(wildcard);
}

// http://website.debug/
framework.route('/', root);

@petersirka
Copy link
Collaborator

Ahh I know what you need ...

function sudomain() {
   var self = this;
   // self.subdomain -> future version

   var subdomain = self.req.subdomain;

   // IMPORTANT: subdomain contains also www (this I fixed in new version)
   // new version will be this week (maybe)

   self.json(subdomain);
}

Thanks.

@hockeyst
Copy link
Author

Thanks, cool framework! I love it :). Simple & clean!

@petersirka
Copy link
Collaborator

Thanks :-)
New version will be very good.

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