I am new in node and react, and I am trying to do subdomain routing in my MERN application. I have found out that I cant route my subdomains in react, so that leaves me with node. In node, there are many ways to it, like vhost, or by
app.get('*',(req,res)=>{
res.sendFile(path.resolve(__dirname,'client','build','index.html'))
})
But my question is, do I have to make different apps per subdomain? for e.g.
- for admin.application.com -> admin app in react
- for otherdomain.application.com-> other app in react
- for just application.com -> one more app in react.
Is this the only way to do it? If yes, can someone with more experience tell me more about this way? If no, please guide.