Handling Session Persistence with Passport.js serializeUser and deserializeUser
Learn how to implement serializeUser and deserializeUser in Passport.js to maintain user sessions and avoid the 'undefined req.user' problem.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Learn how to implement serializeUser and deserializeUser in Passport.js to maintain user sessions and avoid the 'undefined req.user' problem.
Forgetting <code>next()</code> in Express middleware causes requests to hang indefinitely. Always call <code>next()</code> unless you are terminating the request via <code>res.send()</code> or passing an error via <code>next(err)</code>.
KrakenJS adds guardrails to Express through configuration-driven middleware and module-based routing. This blog walks through a real feature-module workflow, shows where the Dust.js default creates friction, and gives a 10-minute test to decide if the trade-offs fit your team.
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.
When Express sits behind Nginx or a CDN, req.ip is wrong by default. Learn how trust proxy works, configure trusted hops safely, and verify client-IP behavior without exposing your app to header spoofing.
Learn how to use Kraken.js convention-based routing to eliminate manual route registration and organize API endpoints using the services directory pattern.
Use express.Router() for feature-level isolation in one Node.js process. Mount routers at prefixes to scope middleware, parameter handlers, and error handling; graduate to sub-apps or microservices as isolation needs grow.
Learn how to architect an Express.js middleware pipeline to separate cross-cutting concerns from business logic, establish trust boundaries, and avoid common pitfalls like hanging requests.
Learn how Express Router lets you group routes, attach route‑specific middleware, and keep your main app file tidy. Follow a step‑by‑step example, discover common mistakes, and see when a router is overkill.