DEV Community

Krypton | Madhusudan Babar
Krypton | Madhusudan Babar

Posted on

1

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.

Top comments (0)

SurveyJS custom survey software

JavaScript Form Builder UI Component

Generate dynamic JSON-driven forms directly in your JavaScript app (Angular, React, Vue.js, jQuery) with a fully customizable drag-and-drop form builder. Easily integrate with any backend system and retain full ownership over your data, with no user or form submission limits.

Learn more