https://blog.bitsrc.io/10-quick-typescript-one-liners-128a2721345
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
Sunday, November 28, 2021
Best practices - API Architecture, Node.js, CI/CD
NodeJs Best Practices
https://medium.com/@quraanmaram/nodejs-best-practices-5793375c3ad8
API Architecture — Design Best Practices for REST APIs
https://abdulrwahab.medium.com/api-architecture-best-practices-for-designing-rest-apis-bf907025f5f
10 best practices every Node.js developer must follow
https://medium.com/dhiwise/10-best-practices-every-node-js-developer-must-follow-32072950a5ac
- Further research on google styles guide and logger tools.
Basics of CI/CD
https://levelup.gitconnected.com/basics-of-ci-cd-a98340c60b04
Saturday, July 24, 2021
New in Mongoose 5.10: Optimistic Concurrency - Safe Save Conflict
Optimistic concurrency is a better way to handle save conflict compare to the article I wrote previously.
https://scalaoncloud.blogspot.com/2021/03/how-to-avoid-save-conflict-in-mongoose.html
Optimistic concurrency tracks the version of the document and increments the version every time save(). If the version of the document in the database changed between when you loaded the document and when you save(), Mongoose will throw an error.
https://mongoosejs.com/docs/guide.html#optimisticConcurrency
https://thecodebarbarian.com/whats-new-in-mongoose-5-10-optimistic-concurrency.html