DEV Community

Krypton
Krypton

Posted on

Handling subdomains with js frameworks

Is it possible to handle subdomains with frameworks?

Here I'm talking about nuxtJS specifically,
I'm having a site, let's say example.com which shares the layout and few components with subdomain blog.example.com, now i want to create common nuxtJS project for this so that the layouts and other things can be shared between them. I already tried to implement it but I'm not getting the expected result...
Let's say I'm having folder structure like:

Pages / main-domain 
     |__subdomain
Enter fullscreen mode Exit fullscreen mode

As we can get subdomain part from window.location,so modifying default routes i can serve the files based on the url, and even my DNS is also configured for wildcard card locations so i can go to *.example.com and it'll show me my site but now problem is that I don't know how can i travel between different subdomains.

Discussion (0)