I hope you have understood the business model of let’s discuss it.

I have some doubts too, drop us a message!

Let’s get it rolling!

Migrating Code From Javascript To Typescript (NodeJS)

Make your NodeJS Typescript code Production Ready

Add Typescript To your existing project

  1. npm install -g typescript
  2. tsc -i– this will create tsconfig.json file
  3. Add following code into jsconfig.json file

Points to take note of

  1. Make sure that all of your typescript code that you want to convert to typescript is inside src folder.
  2. Start converting each file to typescript by renaming the extension to .ts and then convert the code to typescript.
  3. Once you have converted all the files to typescript remove set "allowJs": false in compilerOptions .

Running Code in Production

  1. Once you are done with converting the code. Type tsc this will convert the entire code in src folder to javascript in dist folder.
  2. Now to run your code in production use the following command pm2 start dist/app.js -i 0

Author: Raviteja

Visit the link to read more from Raviteja: https://medium.com/@raviteja.nitj

Related Resources

No Comments »

Leave a Reply

Jungleworks

Get set go for DUAL

+

SALE!

Discounts up to 50%!

Avail heavy discounts on all Junglework Products!

CHECK OFFERS