0

currently i want to deploy an app on Heroku and my app has 2 running commands like this:

img

the command npm run devStart is for my server and peerjs --port 3001 is for server API of PeerJs, now i want to deploy my app on Heroku, please give me a step by step guide to deploy it ( i am totally a newbie with heroku)

Thank you so much and have a good day :)

Tam Do
  • 181
  • 4
  • 15
  • does this answer your question? https://stackoverflow.com/questions/36504768/deploy-the-backend-and-frontend-on-the-same-heroku-app-dyno – dwosk Oct 08 '20 at 18:27
  • 1
    You can use Concurrently. An npm package for running multiple commands concurrently – Rilla Oct 08 '20 at 18:39
  • 1
    Or you could use npm-run-all an npm package for running commands/scripts in sequence or in parallel – Rilla Oct 08 '20 at 18:41
  • thank you Rilla, it worked, thank you so much – Tam Do Oct 08 '20 at 20:16

1 Answers1

0

You can design an executable and put the two commands in it like this:

command 1
time.sleep()
command 2

And then assign the executable to the dyno worker(in heroku) by making a Procfile(file named Procfile) with the following line of code(assuming you named the executable file 'exec'):

worker: ./exec
Dharman
  • 30,962
  • 25
  • 85
  • 135
Lyrax
  • 331
  • 2
  • 6