skip to Main Content

i have got a problem, which i am trying to find a solution for weeks now.
I think it´s an understanding error on my side, but i couldn’t figure it out.
What i am trying to do:

Develop, not deploy, a react app on an Apache2 server.

I know that react is an frontend library, so it should be possible to do.
I also know that nodeJs is kinda required to “npm” all the packages and to create the “Simple” react app..

What i want also to do:

  1. Use the MATERIAL-UI
  2. Build a PHP Backend
  3. Collaborate with my Team Members (they should also work on the react app)

Thanks in advance.

2

Answers


  1. Hosting a ReactJS App is no different than hosting any other javascript code on any type of server – by having it as a static file on your web server and including it in the html returned from the server.

    Depending on the way your React project is set up, you would:

    • use node to build a javascript bundle of your react app (possibly by running “npm run build” in any CLI),
    • include the resulting script file or files in the head element of your root or master template
    • Make the Apache web server return the needed page with the master template where the script tag is

    Additional setup could include starting the PHP server and react development build at the same time, but that is highly specific on your setup and would require you to add some more information on used frameworks and setup.

    Login or Signup to reply.
  2. It is not possible to deploy apps with Apache and React. The nodejs based- Webpack server is incompatible with Apache web server. You’ll have to pick one server or another, you can not route index.html -> index.tsx and vice versa. Besides if you ever got both servers working in tandem with SSL, it’s a technically security nightmare and has no production value. It’s best to avoid java(script) all together as it’s merit in real software development has greatly diminished. Mostly for gold diggers.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search