O'Reilly logo

TypeScript Microservices by Parth Ghiya

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

package.json 

Now that we know how data flows, let's understand how to make it ready to serve. Install TypeScript and rimraf as dependencies and add the following inside the scripts tag:

"scripts": {  "start": "npm run clean && npm run build && node ./dist/index.js",  "clean": "node ./node_modules/rimraf/bin.js dist",  "build": "node ./node_modules/typescript/bin/tsc"},

To run the entire process, execute the following command:

npm run start

This will first delete the dist folder if it exists, and then, based on the src folder, it will transpile the folder and generate the dist folder. Once the dist is generated, we can run our server with node ./dist/Index.js and npm run start in combination.

In a later chapter, we will do more things here, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required