DEV Community

Discussion on: Developing an Express Application Using TypeScript

Collapse
 
nickytonline profile image
Nick Taylor • Edited

One thing you could do is also add nodemon into the mix.

GitHub logo remy / nodemon

Monitor for any changes in your node.js application and automatically restart the server - perfect for development

Nodemon Logo

nodemon

nodemon is a tool that helps develop node.js based applications by automatically restarting the node application when file changes in the directory are detected.

nodemon does not require any additional changes to your code or method of development. nodemon is a replacement wrapper for node. To use nodemon, replace the word node on the command line when executing your script.

NPM version Travis Status Backers on Open Collective Sponsors on Open Collective

Installation

Either through cloning with git or by using npm (the recommended way):

npm install -g nodemon
Enter fullscreen mode Exit fullscreen mode

And nodemon will be installed globally to your system path.

You can also install nodemon as a development dependency:

npm install --save-dev nodemon
Enter fullscreen mode Exit fullscreen mode

With a local installation, nodemon will not be available in your system path. Instead, the local installation of nodemon can be run by calling it from within an npm script (such as npm start) or using npx nodemon.

Usage

nodemon wraps your application, so you…

There are VS Code recipes to handle this.

Specifically this one, github.com/microsoft/vscode-recipe...

Even if you don't use VS Code, the tips provided are still helpful (see the npm scripts in the repo).

One thing I would recommend is to not use ts-node for production as you currently are for your npm start script. The reason being is it is a debugging/dev tool, much like babel-node. Consider transpiling and running the dist/server.js with good ol' node.

Looking forward to your next post!

Collapse
 
itachiuchiha profile image
Itachi Uchiha

Thanks, Nick.

I'm usually using the VS Code. I never heard the vscode-recipes before.

I'm trying to best :)

I don't remember clearly but I may have used nodemon before. It worked so slow on my computer. I know, it depended on my computer. I use a really old laptop.

Again I will say, these recipes are really helpful to me.

Thanks :)