-1

i am trying to Create a project through Create-react-app boilerplate then add a Backend Folder in Src and add Express Server With Name Server.js Inside That Backend Folder. Now i am Adding A Custom Script in Package.json Which is in Root Folder . Now Starting node Server and React App both but Both Together is not Starting ... ! so Can Any one help me for Project Structure Code https://user-images.githubusercontent.com/33281012/39673209-94965c6a-5155-11e8-9dee-3be3968dd2d7.png for Express https://user-images.githubusercontent.com/33281012/39673212-a18befa2-5155-11e8-8b92-28de75a2148e.png

OutPut

https://user-images.githubusercontent.com/33281012/39673220-ecc8526c-5155-11e8-92b3-88c2652771ba.png

best Of luck in Advance

  • 1
    Possible duplicate of [Bash script processing commands in parallel](https://stackoverflow.com/questions/19543139/bash-script-processing-commands-in-parallel) – Diasiare May 06 '18 at 12:42
  • 1
    Please include code in code blocks and not as images. It makes it much easier to answer your question. – Diasiare May 06 '18 at 12:44

1 Answers1

0

You command (npm start && npm run server) starts webpack server and backend server sequentially: backend server will not start until webpack server exits.

What you need to do is to run them in parallel. You can achieve this using concurrently package.

Install it:

$ npm install --save-dev concurrently

And change your dev script like so:

"dev": "concurrently \"npm start\" \"npm run server\""
mpontus
  • 2,143
  • 2
  • 19
  • 21