How to Teach Express App to Speak TypeScript Fluently π©οΈ
Leveraging TypeScript's powerful features to build more robust and maintainable APIs. Type safety, DX and code quality in node.js backend
step 1 - install typescript and typescript watch package -
npm i typescript -D npm i tsc-watch -D
step 2 - cd to folder - make typescript config file
tsc --init
step 3 - make some changes in tsconfig -
"rootDir": "./src"
"outDir": "./dist"
step 4 - go to package.json and make some scripts
"start" : "node dist/index",
"build" : "tsc -p .",
"dev" : "tsc-watch --onSuccess \\"node dist/index.js\\" "
step 5 - adding dotenv
to the mix too.. (make this change in step 4 dev script)
"dev" : "tsc-watch --onSuccess \\"node -r dotenv/config dist/index.js\\" "
Thanks for reading β¨ I hope you found these insights valuable. If you learned something new today, don't forget to share this knowledge with others who might benefit from it.
Letβs connect on, Twitter , Linkedin Find all the other important links at, Linktree π
Until next time! Goodbye ππ»
Β