https://medium.com/@rishicentury/how-to-use-whatsapp-cloud-api-6c4b4a22fc34
Sunday, November 6, 2022
Monday, October 24, 2022
Saturday, July 9, 2022
10 Powerful React Tools That You Should Know in 2022
Strorybook is something to try out.
https://storybook.js.org/
https://javascript.plainenglish.io/10-powerful-react-tools-that-you-should-know-in-2022-76efa7fa711d
useMemo and useCallback in React
https://medium.com/@jakobclausen/usememo-and-usecallback-in-react-913d307eb69
Friday, May 20, 2022
PM2 run different node version
To run several versions at the same time. In pm2, you can use the --interpreter options and specify the path to the node version you want.
You may install different node versions using nvm.
Install NodeJS using Version Manager
Running direct script using PM2 process file:
module.exports = {
apps : [{
name : "app1",
cwd : "/home/user/app1", // folder store the application
script : "./app.js", // starting js file
interpreter : 'node@6.9.1' // Node version
},
{
name : "app2",
cwd : "/home/user/app2",
script : "./app.js",
interpreter : 'node@12.9.1'
}]
}
Running using npm script using PM2 process file:
module.exports = {
apps : [{
name : "app1",
cwd : "/home/user/app1", // folder store the application
script : "/home/user/.nvm/versions/node/v6.9.1/bin/npm", // Folder where the npm stored
args : ["run", "start"], // Argument pass to npm
interpreter : 'node@6.9.1' // Node version
},
{
name : "app2",
cwd : "/home/user/app2",
script : "/home/user/.nvm/versions/node/v12.9.1/bin/npm",
args : ["run", "start"],
interpreter : 'node@12.9.1'
}]
}
Tuesday, May 3, 2022
Sunday, April 17, 2022
Wednesday, March 30, 2022
Sunday, February 27, 2022
Saturday, February 12, 2022
Saturday, February 5, 2022
Wednesday, January 12, 2022
TS-Node: Typescript execute engine
In my previous article, I have described how to create a simple typescript nodejs project. The method works fine in a small project, but take longer compilation time on a large project because its need to compile all typescript files on every change.
Create Node.js & Express.js with Typescript Project
The solution is using ts-node where it direct run the typescript without compiling it to javascript.
- Follow the steps to create a Node.js & Express.js with Typescript.
- Type "npm install -g ts-node".
- Add an entry to package.json."scripts": {"test": "echo \"Error: no test specified\" && exit 1","build": "tsc -b","start": "node dist/app.js","dev": "nodemon dist/app.js","dev:ts": "nodemon --exec ts-node src/app.ts"},
- Now you can just run the development using 1 console: npm run dev:ts