Fading Coder

One Final Commit for the Last Sprint

Node.js MySQL: Distinguishing Between createConnection and Connection Pools

When developing applications with Node.js that interact with a MySQL database, understanding how to manage database connections is crucial for performance and resource efficiency. The mysql module provides two primary methods for this purpose: mysql.createConnection() for direct, single-use connecti...

Introduction to Express.js Framework

While the built-in HTTP module provides basic functionality, it lacks support for session and cookie management. Express.js serves as a higher-level framework that builds upon the HTTP module, offering enhanced features including session handling and improved usability. Think of Express as a server-...

Building Custom jQuery and Developing a Knockout.js Table Application

Building a Custom jQuery Library jQuery introduced a feature allowing developers to construct custom builds of the library, containing only the required components. This minimizes the file size, wich is particularly beneficial for mobile and performance-critical applications. The process involves us...

Implementing a Class-Based Web Scraper for Baidu Image Search with Node.js

const phantom = require('phantom'); const fs = require('fs'); const cheerio = require('cheerio'); const request = require('request'); class ImageScraper { constructor() { this.searchUrl = 'https://image.baidu.com/search/index?ct=201326592&z=&tn=baiduimage&word=%E6%BC%AB%E5%A8%81%E5%9B%BE...

Performing Bulk Field Updates Across All Documents in MongoDB

Process Overview The implementation of updating a specific field across all documents in a MongoDB collection involves three main steps: Step Description 1 Establish connection to MongoDB instance 2 Reference the target collection 3 Execute bulk update operation Implementation Step 1: Connect to Mon...

Understanding the nextTick Function in Node.js and Vue.js

The nextTick function is used to schedule a callback to run as soon as the current operation completes. In Node.js, process.nextTick() executes in the microtask queue, prioritizing it over I/O operations, timers, and setImmediate. This ensures code runs after the current execution context finishes b...

Implementation Guide for JWT Authentication, Vant UI Integration and Common Interactive Features in Vue + Node.js Mobile Fullstack Projects

Backend JWT Authentication Setup Install jsonwebtokan dependency first: npm install jsonwebtoken --save Generate JWT on successful login Add login endpoint handler in user route file: const jwt = require('jsonwebtoken'); const bcrypt = require('bcryptjs'); router.post('/api/user/login', async (req,...

Implementing Silent Token Refresh in Vue and Node.js Applications

User experience suffers when an applciation forces a logout due to an expired authentication token. Silent refresh addresses this by transparently renewing tokens in the background. Token Refresh Strategies Redis-based Token Extension A common backend-driven approach stores tokens in Redis with a co...

Node.js HTTP Request Handling

To handle HTTP requests in Node.js, we utilize the built-in http module. This guide walks you through creating a server, handling GET requests with query parameters, processing POST requests, and a combined example. 1. Creating an HTTP Server The http module in Node.js enables us to set up an HTTP s...

Practical Notes for Getting Started with JeecgBoot Low-Code Development

After obtaining the source code from the official site, follow the setup instructions to launch the front-end and back-end components of the decoupled project. Environment Constraints On Windows 7, Node.js must be version 10 or earlier; newer releases are incompatible. When using MySQL, executing th...