Skip to content


 Zabbix
 Grafana
 Prometheus
 Threejs and TypeScript
 SocketIO and TypeScript
 Blender Topological Earth
 Sweet Home 3D
 Design Patterns Python
 Design Patterns TypeScript
   
 Course Coupon Codes
Three.js and TypeScript
Kindle Edition
$9.99 $14.99 Paperback 
$29.99 $34.99




Design Patterns in TypeScript
Kindle Edition
$9.99 $14.99 Paperback
$19.99 $24.99




Design Patterns in Python
Kindle Edition
$9.99 $14.99 Paperback
$19.99 $24.99




TSC Watch, Nodemon and Concurrently

Video Lecture

TSC Watch, Nodemon and Concurrently TSC Watch, Nodemon and Concurrently TSC Watch, Nodemon and Concurrently

Description

After creating the tsconfig.json, we can now compile and watch for changes using

tsc -p src/server/ -w

We can host using

node dist/server/server.js

The nodejs doesn't restart when there are changes to the files, so we can install nodemon

npm install nodemon@2 --save-dev

Now host the server using

npx nodemon dist/server/server.js

Note

Note the use of the npx before the nodemon command above. Since nodemon was installed locally to your project, you cannot call it directly from the command line unless it is also installed globally. Prefixing the nodemon command with npx, as I do above, allows you to bypass the need to install it globally.

Rather than typing these compile and nodemon commands all the time, we can create a single command to start both processes at the same time.

Install concurrently

npm install concurrently@6 --save-dev

Add this line to the package.json scripts section

"dev" : "concurrently -k \"tsc -p ./src/server -w\" \"nodemon ./dist/server/server.js\"",

And start using

npm run dev