Skip to content

TSC Watch, Nodemon and Concurrently

Video Lecture

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

 (Pay Per View)

You can use PayPal to purchase a one time viewing of this video for $1.49 USD.

Pay Per View Terms

  • One viewing session of this video will cost the equivalent of $1.49 USD in your currency.
  • After successful purchase, the video will automatically start playing.
  • You can pause, replay and go fullscreen as many times as needed in one single session for up to an hour.
  • Do not refresh the browser since it will invalidate the session.
  • If you want longer-term access to all videos, consider purchasing full access through Udemy or YouTube Memberships instead.
  • This Pay Per View option does not permit downloading this video for later viewing or sharing.
  • All videos are Copyright © 2019-2025 Sean Bradley, all rights reserved.

Description

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

tsc -p src/server/ -w

We can host using,

node dist/server/server.js

However, note that the node executable doesn't restart when there are changes to the server code. So instead, we run it using nodemon.

npm install nodemon --save-dev

Now host the server using

npx nodemon ./dist/server/server.js

Note

You cannot run nodemon 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 --save-dev

Add this scripts section into our package.json, after the license line.

1
2
3
  "scripts": {
    "dev" : "concurrently -k \"tsc -p ./src/server -w\" \"nodemon ./dist/server/server.js\""
  },

And then we can start, just by typing the command,

npm run dev