Using both Django template and React - reactjs

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.

Related

Loading a React webpage into an iframe on a asp.net webforms website with authentication

I have a complex requirement, where we have an asp.net webforms site we want to try and upgrade in a step by step way. We are considering using React (frontend, with asp.net core backend) for this purpose. The website has an iframe in the centre, and we want to try and replace the old content with the new completely separately hosted React content. This needs to occur after clicking a link on the asp.net webforms page.
I managed to create a ‘Create React app’ website prototype and it was simple to load it into the iframe by linking directly to the React website. I came unstuck when I wanted to try and add an authentication token into the header (oauth2 with openid connect for use with IdentityServer). The only way I could see to do this was to try using javascript to add the header by making an XMLHttpRequest object (or I tried also using the Fetch API) and this partially worked but not everything was correctly loaded.
I see for example an answer here How to embed React App into another website which I assume is the best way to add the website into an iframe.
So, I can’t find much on the internet about dealing with authentication… I guess because asp.net webforms are so old by now, but I assume others have wanted to do something similar before. The question I have, is what would be considered to be the best way to do this? I don’t know if I’m going in completely the wrong direction.

How To Integrate ASP.NET MVC Backend To Existing React Frontend In Least Invasive Manner?

I recently joined a team with an existing React.js web project. We want to add a ASP.NET MVC backend to this application, but ideally, we want the option to complete the integration slowly without taking down the existing application for a full refactor.
My question is, what is the least invasive way to integrate this new backend, if our priority is to rewrite as little of the frontend as possible right off the bat?
I have seen a lot of information on using Babel to integrate the React.js frontend directly into the ASP.NET MVC file structure, but it might be ideal to keep them as separate projects for now. It does not matter that they compile and build together, we would be fine launching the backend and frontend separately starting out. Really, we would ideally just re-route traffic from our front end to our new backend without changing the front-end project at all.
What we have tried: We did get a ASP.NET MVC backend with a React.js frontend set up using Babel, but wanted to check to see if anybody here has done something similar before copying our entire file structure over.

Need to Deploy Laravel + Reactjs (SEO friendly ) application

I have to create an application where users will have their unique usernames and profiles like "website.com/JohnDoe". for that the client asked me to develop it in any good PHP framework and client also need an android/ios app (which he disclosed after 2nd meeting) . so I was(before 2nd meeting) going to use Laravel totally. but since he said he wanted a mobile app too, so I decided to use Laravel as backend API, for Web frontend I will use Reactjs and for Mobile I would use ReactNative ( I've done same before). since Laravel provides react support so my I was planning to use React within the laravel.
Then client said he is more concern about SEO of his website. so I had two options
Use laravel as API provider only. and create ReactJS app totally separate from Laravel.
In this case I will need Nodejs server. Then I thought If I have a nodejs server than why would I go for laravel, I could use Express.
Use ReactJS within laravel and use any SSR package to cope with ssr.
If I am going for second option, can anyone point me to already live website which uses React Helmet SSR or Laravel-react-ssr?
Laravel react-ssr: https://github.com/spatie/laravel-server-side-rendering
React Helmet-ssr: https://github.com/nfl/react-helmet#server-usage
I have read both, and I am too confused. I am beginner in both Laravel and React(node) so I am unable to understand what both are proposing.
i deployed your 2 option mentioned let me give you the site https://v3.topviewnyc.com/, i created a microservice which would take care of SSR besides my hooks and components are build on react so am totally able of enjoy the SPA frontend side with react using components and get data via laravels API

Create Lumen 5.5 - React Project from scratch

I need to create a new project using reactJS and lumen 5.5 and i was installed lumen 5.5 and reactJS. but then i was stuck, so i have some questions:
where is the position of the reactJS folders should be?
how i can add a react component in the home page with data-source from lumen api?
how we can integrate between them?
what the content of package.json should be?
i will appreciate any clear answer, because i was spent alot of time to make an integration between them without any results.
Lumen isn't intended to have views, it's primarily intended to be a lightweight API framework. If you want views and a front end, you should use Laravel. Which also comes with a react preset to get you started right away. Laravel also has API routes built in that you can use for your API. The good news is that your code from Lumen should be fairly easy to transfer over to a Laravel project.

building blog using react.js and express.js

I am a web developer tries to learn React.js. I am thinking about a blog for my first React project. Based on articles and tutorials I have read in the past few days, I am thinking about to use Node.js, Express.js and MongoDB for my server side and React.js for the front-end. Before I start, I want to be clear on few questions I have.
Are those enough to build a blog? Can React.js be used for UI without other template library such as Handlebars?? I have seen few articles using both React and Template engine and confused if I am going to need another template engine.
Can I use Json as communication method(Restful API) between the UI and the server?
Yes for all. But I suggest to use Redus(or Flax) to control all states.

Resources