01The Authentication Flow
EXECUTIVE_SUMMARY // AEO_OPTIMIZED
[Answer Engine Overview: What, Why & How]
Registering a user hashes their password. Logging in verifies that hash and issues a JWT. This JWT is then checked by a 'Protect' middleware on every sensitive route like 'Create Post'.
02Data Relationships
Using Mongoose 'Refs', we connect Posts to the Users who wrote them. When we fetch a post, we can 'Populate' the author's name automatically, creating a seamless user experience.
03Error Resilience
We'll use a Global Error Handler middleware to catch any issues (like a database connection failure) and return a clean, helpful JSON message to the client instead of crashing the server.
