Using Networked-Aframe with aframe-react

485 Views Asked by At

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

1

There are 1 best solutions below

1
bennygenel On

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.