Is subdomain possible in React JS - reactjs

Hi I am creating an app which have 3 parts- Admin, Client and User. Admin has all the features, while client has some of the features while client has some. So I thought to have a common code base and will be providing access based on subdomain.
Now I could not find any suitable article across the internet for the same.
Lets say the user clicks the link admin.company.in/login it will open admin login page.
Similarly, client.company.in/login will open client's login page
How can I achieve this and also test it locally?

React has nothing to do with this. You have to build two different react applications and server them client.company.in and admin.company.in respectively. To achieve this you have to deploy the application to the server and server with webserver (eg:nginx).

Related

Can I use different domains with react-js app

I have a web pages constructor.
Every user has opportunity to create web page on my resource.
There are several examples of that pages:
1 https://candylanding.netlify.app/601b1141bfa41700154f7e13
2 https://candylanding.netlify.app/6022ec4641423100151632d7
As you can see the url-addresses of these pages are ugly.
And I am sure that many users want to change it on some beautiful short name (such as DOMAIN.COM)
How can I achieve this? Please give me an idea..
using create-react-app, react-router-dom
Domain allocation is based off of domain ownership, so unless you own DOMAIN.COM users will not be able to use it.
Cloud platform as a service (PaaS) providers like Netlify and heroku use subdomains before the domain to create a clean URL, but you will need access to your server to do this (it won't be possible on netlify)
I think a good first step is allow users to name their route:
ie:
https://candylanding.netlify.app/my-user-site
instead of
https://candylanding.netlify.app/6022ec4641423100151632d7
Once you have that running you can then have a look at this question to dynamically create subdomains:
How to let PHP to create subdomain automatically for each user?

Is it possible to create an icon on the home screen of a phone using reactJS?

I built a website with reactjs and the client wants that the web automatically creates a link on the phone home screen that opens chrome to the specific url of my website.
Is this possible without wrapping the reactjs with another framework like Cordoba, Ionic or React Native?
Thank you so much
A web application has no access to the device's internal APIs. Web applications are naturally subject to the browser's features, restrictions and limitations in which it is running on. Even native applications has to request access from the user to have such permissions. What your client asks is, regretably, impossible.
I agree with the above answer by #Lux Ilustre. You can't add the application link to the phones homepage without the users permission. But it is possible to make your website installable with a PWA. You can create a PWA with a manifest file and a service-worker file which makes possible to install the website to the users phone and load assets from cache which makes it possible to make some parts of your website function offline.

Connect Apache OFBIZ database to website application (HTML,CSS,JS)

Im trying to connect a website i've built using HTML, CSS and JS to the Apache OFBIZ database I have built.
The web app's main purpose is to allow the user to download the app and order the case, and allow them to put in their personal details including method of payment and purchase the case through, by connecting to the OFBIZ data base which has a number of fields that once approved will confirm the order and notify the relevant members of the manufacturing process and allow the user to see that their order has been received and confirmed.
thanks in advance,
H
OFBiz is a web development framework with ERP business modules on top of it. It's made to be enhanced and you can build your own web applications with OFBiz. I would simply build the website with OFBiz, providing a form for the user detail input. You will have all options to use the database, services etc..
If you have to access OFBiz with a native app (IOS, Android & Co.) you might want to implement some RESTful services to connect OFBiz with your app.
From what I understand, I would migrate the website to OFBiz. If it has a responsive UI design, it will run nicely on smartphones.

S3 - Routing for multiple React application

I am deploy 3 React applications using S3. I am facing a routing problem which I am explaining through an example.
Lets assume the three applications are
1. A login Portal
2. Driver portal
3. Passenger Portal
The login portal is common for both driver and passenger. Once we login as a driver it will direct to Driver Portal. Similarly for passenger portal too login works.
I am using JWT token based on which I am validating the client side routing using React Router. This works locally fine if I have three dev server each for the apps. I am able to redirect from one server to the other.
For example if I run my login at port 3001 and passenger at 3002, On successful login just redirecting it to 'localhost:3002/passenger/:passengerId'
I am trying to deploy statically by generating three folders.
The three three folders is having routes like
1. "/login"
2. "/passenger"
3. "/driver"
The problem I am facing is I am not able to navigate by using the address bar for nested route. For example if I want to access "/passenger/:passengerId", it throws no page found since it is just a static deployment.
I need a solution where I can Hit directly any nested route. This I guess can be done by providing any kind of fallback if we have a nested route starting with "/passenger/***" to fallback to the index.html inside the passenger folder.
I am not exactly sure how this can be done. Or even if there is a different approach by which I can deploy it would be helpful.

Using the Google Users Service with jQuery Mobile

I was wondering what would be a better way to let my jQuery Mobile app "know" the user of the app after completing a registration process.Since the handlers in my Python Google App Engine app expect a username, i decided to store the username in localstorage and then use this as part of any request made to the server.But i don't think this is a good design idea (?).After a lot of search, i have found that jQuery Mobile does not support Google login (Please correct me if am wrong) So i have decided to use the Users Service from the server end.I am confused on how to implement this, since the users service from Google has it's own sign-in form.
Is it possible to use this same service with jQuery? If so, can i change the design of the sign-in form to blend in with the design of my jQuery app?
jQuery Mobile is just a template designer created directly for mobile web applications using a mobile web browser. It does not possess any connections with server side scripting automatically.
You need to create a connection using server side scripting.
Once you login in using the Google Login, your app associates it with the Google account.
jQuery is just a browser scripting. It does not have an automatic connection with the server unless you connect using AJAX to request to a server, but still need to code the server using HTTP protocol (as a tunnel) and server side scripting language like Java, Python, or PHP.
If you just want to get the "username" using a javascript, you may use REST to get the user information after login. You may look for how JSON or XML REST is created (but putting the username on local storage is not a bad option, without the password, however it may get deleted if you clear the root), but knowing that you are already connected with Google Sign in, just as long as you are already logged in with Google, your app should be able to retrieve the Google username.
Udacity also contains a complete course about web development focused on Google App Engine using Python, and how you may use cookies, password encryption, as well as user login. A detailed information about HTTP protocol is also discussed.
https://www.udacity.com/course/cs253
Note that the course I took existed 2 years ago. It may be different now.

Resources