Passport Custom Callbacks: Returning Consistent JSON from API Routes
Passport's default authenticate behavior redirects or returns a bare 401, which breaks JSON clients. A custom callback hands response control back to your route.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Passport's default authenticate behavior redirects or returns a bare 401, which breaks JSON clients. A custom callback hands response control back to your route.
Clients get 413 before an Express route runs. Learn whether the limit comes from Express body parsing, a reverse proxy, or a CDN, and fix the right layer.
Express.Router splits routes across files, but mounting order and param inheritance can trip you up. This post shows a concrete setup and the one flag you need.
An architecture note on Express trust proxy: how req.ip, req.protocol and req.hostname change behind a reverse proxy, the smallest safe trust setting, spoofing and rate-limit failure modes, and when to redesign.
Split growing Express route files into modules, mount routers with prefixes, and scope middleware to specific route groups.
Choosing between Plotly Express and Graph Objects: a quick guide for data analysts and developers. Learn when to use the high‑level API for rapid charts and when to switch to granular Graph Objects for custom dashboards.
Learn how to replace the old body‑parser with Express’s built‑in express.json() middleware. Understand defaults, limits, custom types, and how to verify raw bodies for secure webhooks. Follow the migration checklist to keep your API safe and efficient.
KrakenJS’s JSON‑based config system lets you merge base and environment files, inject secrets via ${ENV_VAR}, and make settings available through app.kraken. Learn how to set up, verify, and avoid common pitfalls in a practical example.
Learn how Express 4.16+'s built‑in express.json() middleware handles JSON bodies, why the default 100 KB limit triggers 413 errors, and how to raise the limit safely with security mitigations.