Monday, December 6, 2021

How to restart the node server after the change in the typescript files in Node Express Server development?

 usually we can use the following configuration in the Package.json file to run the node server with nodemon.

"start:dev": "nodemon --watch './**/*.ts' --exec ts-node src/index.ts"

how the above command will required additional configuration for the nodemon.

ts-node-dev will provide us much better experience since there is not setup configuration. we can simply execute the command below to start the node express server and any change is made the server will automatically recompile and restart.

 "dev": "ts-node-dev src/index.ts"

However you must install the ts-node-dev package to run the command

yarn add ts-node-dev

No comments:

Post a Comment