Skip to content

Instantly share code, notes, and snippets.

@fuentesld
Last active March 2, 2023 00:38
Show Gist options
  • Save fuentesld/0bde4ab5fb21ee62d60dcc29cd7023c3 to your computer and use it in GitHub Desktop.
Save fuentesld/0bde4ab5fb21ee62d60dcc29cd7023c3 to your computer and use it in GitHub Desktop.
Node configuration with express react concurrency

node configuration for concurrent express React in the server

Install concurrently package

On server directory type:

npm i concurrently

In package.json check "scripts" section as above

{
  "name": "billing",
  "version": "1.0.0",
  "description": "Facturacion MultiEmpresas",
  "main": "server.js",
  "scripts": {
    "start": "node server.js","server": "nodemon server.js",
    "client": "npm start --prefix client",
    "clientinstall": "npm install --prefix client",
    "dev": "concurrently \"npm run server\" \"npm run client\" "
} 

For post buid in heroku add this line in scripts

"heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"

For proxy server add on package.json of the client

(json file...)
(last line), <-- Don't forget the comma
"proxy":"http://localhost:5000" <- insert line
} <=last line

Start node

on server directory type

npm run dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment