Adding server.js to an existing react app

Hi Folks,

I’m a newbie to the whole NodeJS ecology - please bare with me!

Loving Glitch - its just what I needed to start learning and prototyping react/nodejs. Thank you Glitch developers!

I uploaded a React app via GitHub which just ran as is. I was amazed! Anyhow I would like to add server.js and whatever so that I can program the server side as well. If I just put in server.js from another project it doesnt find index.html. I’m a bit confused here.

Help appreciated as to what I need to do.


Hi @ianhunterpersonal, welcome to Glitch!

You might take a look at the React starter app, specifically!/starter-react?path=server.js:12:0 which shows how that project serves its index.html file (and correspondingly how the index.html file includes the appropriate React components).

If that doesn’t get you started then any additional detail you can provide regarding where you’re running into problems will help everyone here help you. If you can provide a link to your project so folks can take a look that’s often helpful, and you can always ask for direct help.

Happy Glitching!

Hi @ianhunterpersonal, Also welcome to Glitch!

Anyways, have you checked your package.json ?

At your package.json, you see: scripts - start. What is the name of the file which is listed there?

Is it index.html?