Cloudflare API v4 enables users to update DNS records programmatically, which makes Dynamic DNS (DDNS) implementation possible. I recently wrote a CLI tool called cf-ddns-cli in Node.js to update DNS A (IPv4) and AAAA (IPv6) records with your current IP address, and it's available in Windows, Mac and Linux.
TTL Indexes in MongoDB are very useful for storing data like logs or user sessions. The document will remove itself after a certain amount of time which is specified by the index. This tutorial will be done in both JavaScript and TypeScript using Node.js with node-mongodb-native, which is the official MongoDB Node.js driver.
Knowing whether a link is internal or external is essential for setting rel in HTML a tag. For an external link, noreferrer noopener nofollow is usually recommended. To test a full URL or relative path in JavaScript/TypeScript, we'll be using the URL constructor. It's available in both browsers and Node.js.
While using NVM on Linux, it loads Node.js and NPM from .bashrc in the home directory of your user. However, if you execute the command with sudo like sudo npm start it will result in sudo: npm: command not found since .bashrc of root is not managed by NVM.
Managing Node.js versions on Linux is no longer a pain in the ass with NVM (Node Version Manager). It can install different versions of Node.js and NPM on a single machine, switch versions anytime you wish. And the best part is NVM is just a Bash script, truly a lightweight helper for both testing and production.
Instead of using Telegram bot frameworks like telegraf.js and node-telegram-bot-api, I created a Telegram sender with less than 100 lines of code in Node.js to simply send notifications to myself. And there is nothing wrong with using a full-featured framework, but building your own is definitely easier to maintenance.
I created a simple key-value LRU (Least Recently Used) cache module for storing user sessions of this blog. And with the power of Javascript ES6 Map object, it's easy to implement a efficient cache system. In this guide we'll be building this module from scratch in Node.js with Typescript.
I recently wrote a very simple IP address based rate limit module called rt-limit to throttle requests for this blog. Although rate limiting is more commonly done on reverse proxies like Nginx and Apache, being able to manage traffic on your own back-end server is always more flexible.
I wrote a dead simple JavaScript library called pswd-generator to generate passwords for this blog. In just 23 lines of code, I was able to build a cryptographically-secure password generator thanks to Node.js's native crypto module. And this guide will show you how it's done with TypeScript.
Colors.js, the open source Javascript package used by 4.3 million repositories has recently been corrupted by its owner Marak. Causing the library spamming console with a bunch of garbled characters.