How to make a specific page rendered for a subdomain when using with express?

hvaoc
9
hvaoc
commented 2 years ago

I am using Nuxt with Express.

Out of the box, pages are translated to routes to the main domain.

I am trying to use express-subdomain so that I can have some views (ex: pages/blog/**) rendered under blog.domain.com as well as domain.com/blog.

While other files (other than pages/blog/**) continue to be available under the domain.com only.

2
lomholdt
10
lomholdt
commented 2 years ago

Hey hvaoc! I'm in the same situation and trying to accomplish something similar. Have you had any luck yet?

0
hvaoc
9
hvaoc
commented 2 years ago

No, for a moment I kept that on hold. I tried using express-subdomain + express-vue, but couldn't make it work. @danmademe (Owner of express-vue) told me that it should work, but I couldn't make it work. Check this issue - https://github.com/express-vue/express-vue/issues/142

I have my setup sample there.

It would be great if this support is natively added to Nuxt.

0
lomholdt
10
lomholdt
commented 2 years ago

Thanks @hvaoc ! I got it working using the nuxtServerInit action to set the subdomain in the store. Then I set a isSubdomain and use that throughout the application to render different components based on the subdomain. I'm not using express though.

0
hvaoc
9
hvaoc
commented 2 years ago

Do you have a git repo that I can see ? If not do you mind sharing how you did.

0
Informations
Question โ€ข Unresolved
#c2076 - Created 2 years ago