xxxxxxxxxx
// install package globally
npm i -g nodemon ts-node
// Run this for compile and run:
npx nodemon index.ts
// you can add this in package.json in script section, and run command npm run ts dev
"ts dev": "npx nodemon index.ts"
xxxxxxxxxx
// nodemon.json
{
"watch": ["src"],
"ext": "ts",
"exec": "ts-node ./src/app.ts"
}
// package.json
{
"start" :"rm -rf dist/ && tsc --project . && node dist/app.js",
"dev": "nodemon ."
}
xxxxxxxxxx
# Install nodemon
npm i nodemon
# Write a script like ...
"scripts": {
"start":"nodemon index.js"
}
# Start in your terminal with something like ...
nodemon ./server.js localhost 8000
or
npm run server