0

I'm trying to make a multiplayer game using the Networked-Aframe library with aframe-react. The big roadblock I've run into is I can't simultaneously run:

react-scripts start

to run react and

node ./src/vendor/easyrtc-server.js

to run my server.

Maybe create a production build of my react app, then run the server?

How do I get these two working together?

My easyrtc-server.js: https://pastebin.com/PJ0UchSi

JDorman
  • 89
  • 1
  • 12

1 Answers1

1

You can add new scripts to your package.json file to run different commands.

Example

{
  "name": "someapp",
  "version": "0.0.1",
  "private": true,
  "dependencies": {
     // some dependecies
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject",
    "custombuild": "npm build && node ./src/vendor/easyrtc-server.js"
  }
}

Then when you can run,

npm custombuild

This command will first build your app and then start your server.

bennygenel
  • 23,896
  • 6
  • 65
  • 78
  • Tweaked my question a bit, I'm not just looking to make them run simultaneously, I need the server to work with my fully built react app. It works already if you write straight to the index.html file, but not when actually using react. – JDorman Oct 08 '17 at 21:27