I'm trying to create a ReactJS web app that I can use on multiple websites (clone ?), while it fetches data from a centralized API.
The goal is to develop one app, which I can improve and update, of which I automatically deploy to each website.
What's the best approach to do that?
maybe the simplest way is to have one repositroy all your website use the same repo for your react js app. And you can add and .env file for each website that contain a specifique configuration for each app.
this way you will share the same app , you update one repo and update is shared cross your websites.
One way to solve this I discovered to create environment variables that get passed to the backend through a custom header for example. It's a way of creating a SaaS website.
Related
In my organization we have multiple independent SPAs, each has its own code repo on github under the same closed organization.
I want to have my SPA "host" another SPA, without redirecting the user out of my app, and just allow him to use the other app through mine. Converting to Monorepo is not an option. What is the recommended way achieving that goal?
Hi guys I’m trying to bulid a website which django works as an rest-api and react works as a front side. I manage to do the whole thing just fine and about to deploy it using aws. But there is one thing I couldn’t really get. Inside my django project I have an app that uses only django template to render things to front. And other apps are working only as apis to get and post things via react. Is it possible to deploy this kind of structure without any special options? I searched internet for a while but I couldn’t really find an example that fits my situation. Thanks!
Yes, you should be able to deploy it without extra options: you can have one Django template view to host the React app entry point, and the rest would be Rest API views that are accessed by React.
We have an existing legacy laravel application and like to convert it into a react application for this kind of application we want to migrate but can't do in a big bang way. what is Ideally needed? make a react application and put laravel application in an iframe and then migrate one by one section? thinking of using httpclient and parse dom.
do we have a better way?
Well, firstly you need to actually analyze the scope of work that needs to happen.
Ideally, you migrate component of your Laravel app step by step to React app.
I am trying to create a complex CRUD React Application using Gatsby JS. The ability for the user to Create Posts, Edit Posts, Delete Posts will also need to be available. This app will have many users. We are not using a third-party CMS. Everything will be done within the Gatsby App. There will also need to be several different pages that will need to handle state, display, and sort the different posts based upon options. My question is, is this sort of project overload for Gatsby JS since it breaks the page model? Gatsby doesn't have a native way to generate dynamic routes or views, only pages. Its sort of a social networking app, is Gatsby JS the wrong tool for the job?
You can create pages "dynamically" using the createPages API.
https://www.gatsbyjs.org/docs/node-apis/#createPages
There's also a great series of videos from Scott Tolinski that demonstrate the use of this API.
However, GatsbyJS is a static static site generator, it's designed for performance and more content-based sites. The only way you're going to get CRUD functionality is through API calls from the front-end which could have some security implications that you need to consider.
As an alternative, you might want to take a look at Next.js. Same kind of idea but the pages are served by Express.js rather than just served off the file system so you have a lot more options for more dynamic sites.
I have an existing webapp built on Laravel. I am moving to an Ionic build to create the native version.
How would you suggest I separate my views, and how do I call the routes? Has anyone any example.
Here is what I am about to do:
1. move all my views to the public folder
2. install Ionic in the public folder,
3. Using UI-route & Angular make $http calls to the backend.
Thanks for your input :-)
You can't simply do that.
If you have a "classic" Laravel app with blade templates, what you need to do is to expose an API from it.
Then you create an ionic app in a different directory (they are not related, so you don't have to mix them). You just need to develop your ionic app like any other ionic app. Then in your factories where you do the request to your API, you do something like:
$http.get('https://example.com/api/foo')
Where example.com is the domain of your Laravel application (You are going to need to activate CORS in it).
You just can't simply create an ionic app inside laravel, because that application will be built into an .apk to be installed on the phone and you can't add Laravel inside the package.
So the TL;DR is having your normal Laravel app where it lives, add it some public API so your ionic app can access it and then build an Ionic app from zero that will use that API.
It depends on you, but I prefer to keep the ionic project nested in /public, since I want a single-project app, the sources are clearly separated by being or not in the subfolder, but it helps your productivity, benefits are:
Single source control: Single source set for source version control (GIT, SVN, ...), so when I work I can do a single pull/checkout and push/checkin
Single app to deploy: Single domain, no cross-domain problems, single deploy via FTP is available, any standard php server can handle it with a single and standard account to handle
Coherent project without interdipendencies: I do not want to split logic dependencies of the same model between many projects, when I change something in backend or frontend that involve the other side, I want to have in the same project all the sources to update. It make not sense to have to go to a different project to adjust compatibility, it would be uselessy messy