Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Restart Heroku local on file change?

Tags:

It seems the local server started with "heroku local web" does not watch for file changes and restart itself. How can I make it do this?

like image 869
Joren Avatar asked Dec 08 '15 01:12

Joren


People also ask

How to change heroku local port?

To use a different port, use the -p flag: heroku local -p 7000 . If you don't specify a port, 5000 is used.

How do I restart heroku node app?

If you have the Heroku CLI installed, you can run heroku restart in the folder of your application or run heroku restart --app application_name .

What is a Procfile node JS?

Define a Procfile Use a Procfile, a text file in the root directory of your application, to explicitly declare what command should be executed to start your app. The Procfile in the example app you deployed looks like this: web: npm start. This declares a single process type, web , and the command needed to run it.


1 Answers

The easiest way to do this is to run nodemon with heroku local as the executable - i.e. nodemon --exec "heroku local".

However, heroku local exits with a non-zero exit code for the default nodemon shutdown signal (SIGUSR2), so you need to add an additional flag to nodemon to set the interrupt signal to SIGTERM.

nodemon --exec "heroku local" --signal SIGTERM

(tested with [email protected], [email protected], [email protected])

like image 84
lennym Avatar answered Oct 01 '22 20:10

lennym