express-subdomain-handler | handler takes the headache | Router library
kandi X-RAY | express-subdomain-handler Summary
kandi X-RAY | express-subdomain-handler Summary
express-subdomain-handler takes the headache out of dynamic subdomain routing in Express. It captures the contents of any subdomain and writes them into the Express req.url. This means you can write specific route handlers for subdomain urls. As you can see below, express-subdomain-handler can manage single or multiple subdomains.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Returns a subdomain RegExp for a given base URL .
- Escapes characters in a string .
express-subdomain-handler Key Features
express-subdomain-handler Examples and Code Snippets
Community Discussions
Trending Discussions on express-subdomain-handler
QUESTION
General idea of the web page:
- domain.com : leads to login page for admin and seller.
- shop.domain.com : leads to the shop of the seller.
- Planning to use React.js as frontend and Nodejs (Express Js) for backend.
- Haven't decide to host everything on Heroku, or only Nodejs backend on Heroku and React.js at somewhere else, since we are separating the development process.
How to redirect user to respective page according to the URL access (with or w/o subdomain)
In fact, there is a package from npm named express-subdomain-handler
that aids the domain and subdomain routing in the server side, and I have no problem to done it and deploy to Heroku.
ANSWER
Answered 2020-Dec-11 at 09:09I think this is not on react part. React is the browser library and cannot handle the domain part.
I don't recommend to handle this part with express also since this need to use reverse-proxy, you'd better use Nginx,Apache, some other server engine to handle subdomain.
What you planned can be hosted like this,
Domain
- create domain.com
- add cname to shopping.domain.com
Server
- create admin server, client server
- reverse proxy those servers
Client
- create 2 react project.
- domain.com serve admin react build file.
- shop.domain.com serve shop react build file.
I also recommend static file hosting for admin react application, if you don't need to expose the admin page for the search engine.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install express-subdomain-handler
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page