Node
-
Node
Fix JWT Errors: jwt malformed, jwt expired, invalid signature and invalid token
Each jsonwebtoken error has a specific cause. “jwt malformed” means the value is not a token at all, often the text "undefined". “jwt must be provided” means it was empty. “invalid token” usually means the Bearer prefix was not removed. “invalid signature” means the secret differs from the one that signed it. “jwt expired” means the expiry time has passed.
-
Node
Fix “Error: Cannot find module” in Node.js (MODULE_NOT_FOUND)
Node.js shows “Cannot find module” when it can’t locate a file or package you required or imported. If the name is a package, run npm install for it in the project folder. If it is your own file, fix the relative path: start it with ./ or ../, match the exact letter case, and in ES modules include the file extension such as .js.
-
Node
Fix “Error: listen EADDRINUSE: address already in use” in Node.js
The error “EADDRINUSE: address already in use” means another process is already listening on the port your Node.js server wants, usually an older copy of your own app. Find it with lsof -i :3000 (macOS and Linux) or netstat -ano | findstr :3000 (Windows), stop it, or start your server on a different port. Then add graceful shutdown so the port is released every time.
-
Node
Fix “Cannot use import statement outside a module” in Node.js, Jest and the Browser
The error “Cannot use import statement outside a module” means code with import was loaded as CommonJS or as a classic script. In Node.js, add "type": "module" to package.json or rename the file to .mjs. In Jest, use babel-jest, native ES module mode or Vitest. In the browser, load the file with .
-
Node
Zod vs Joi vs Yup: Which Validation Library Should You Use?
Pick Zod for TypeScript and full-stack projects, because one schema gives you both validation and types and it works in React and Express. Pick Joi for JavaScript-only Node.js APIs where its mature, expressive rules shine. Pick Yup if your forms already use Formik and you mostly validate in the browser.
-
ExpressJS
Helmet.js: Secure Your Express App With HTTP Security Headers
Install helmet and add app.use(helmet()) near the top of your Express app. It sets security headers such as Content-Security-Policy, Strict-Transport-Security and X-Content-Type-Options, and removes X-Powered-By. If your page breaks afterwards, it is usually the Content Security Policy blocking a script, image or API domain, which you allow in the CSP directives.
-
Backend
Webhooks Explained: Build and Secure a Webhook Endpoint in Express
A webhook is an HTTP POST another service sends to your server when something happens, such as a payment succeeding. To receive one safely in Express, read the raw body with express.raw(), verify the signature header with HMAC and crypto.timingSafeEqual, respond with 2xx quickly, do slow work in the background, and ignore duplicate event ids.
-
Backend
GraphQL vs REST: Which API Style Should You Use?
Choose REST for most APIs: it is simpler, works with HTTP caching out of the box, and every developer knows it. Choose GraphQL when many different clients (web, mobile, partners) need different shapes of deeply related data, and you want them to fetch exactly what they need in one request.
-
Backend
Node.js Essentials: 10 Core Concepts Every Developer Should Know
The Node.js essentials are: running JavaScript outside the browser, modules (require or import), npm and package.json, the event loop and non-blocking I/O, async/await, built-in modules such as fs and path, EventEmitter, streams, environment variables through process.env, and handling errors so one failure doesn’t crash the server.
-
ExpressJS
Express POST Routes: Handle JSON, Forms and File Uploads
To handle POST requests in Express, add app.use(express.json()) for JSON bodies and app.use(express.urlencoded({ extended: true })) for HTML forms, then read the data from req.body in app.post(). Validate the input, save it, and respond with 201 Created and the new resource. Use multer for file uploads.
-
Node
LPA Redux: Why It is so Important for State Management
Introduction What is LPA Redux? Importance in Modern Development History and Evolution of Redux Traditional Redux Emergence of LPA Redux [...
-
Node
Node.js on Ubuntu: Moving Off 16.04 and Tuning Your Server for Performance
Ubuntu 16.04 is too old for current Node.js: official Node.js 18 and newer binaries need a newer system C library than 16.04 provides, and its standard support ended years ago. Move to a current Ubuntu LTS (a fresh server and a migration is usually safest), then tune it for Node.js with PM2 or systemd, higher open-file limits, a swap file, Nginx in front, and profiling before guessing.












