Node.js: Escape dangerous HTML content in Pug templates
Introduction When developing web applications with Node.js and Pug as the templating engine, it’s crucial to consider security measures to prevent possible attacks, such as Cross-Site Scripting (XSS)….
ExpressJS: Conditionally Render Content in Pug Templates
Introduction to Pug Pug, formerly known as Jade, is a high-performance template engine heavily influenced by Haml and implemented with JavaScript for Node.js and browsers. It provides a…
NodeJS: How to include subviews in Pug templates
Introduction Pug is a high-performance template engine heavily influenced by Haml and implemented with JavaScript for Node.js and browsers. It facilitates writing cleaner and more readable HTML. Its…
NodeJS + Pug: How to create reusable layouts (header, footer)
Overview When building web applications, maintaining a consistent look and feel across your pages is essential. Using NodeJS together with Pug (formerly known as Jade), a high-performance template…
NestJS: Connecting to Different Databases Based on Routes
Overview In modern web development, the need to interact with multiple databases within a single application is increasingly common. This requirement arises from various business needs, including separating…
Sequelize.js: How to Drop FOREIGN KEY Constraints
Introduction Sequelize is a powerful library for Node.js applications that makes it easier to manage SQL databases. It enables developers to work with data in a more high-level,…
How to read a QR code image in Node.js
Introduction QR codes have become a ubiquitous part of our digital experience, enabling quick access to information, websites, and much more. For developers looking to integrate QR code…
How to generate QR codes in Node.js
Introduction to QR Codes QR codes (Quick Response codes) are two-dimensional barcodes that can store a significant amount of data, which can be scanned using smartphones and other…
How to create a fixed-size collection with MongooseJS
Introduction Dealing with fast-growing databases can present significant challenges, particularly when you want to maintain a fixed-size collection where old data is seamlessly removed to make room for…
How to install NPM modules globally without ‘sudo’ (3 ways)
Introduction Node Package Manager (NPM) is an essential tool for JavaScript developers as it serves as the default package manager for the JavaScript runtime environment Node.js. By default,…