How spandan2106/multi-user-blogging-platform-api-in-node.js---express.js-2026 works
This is a Node.js/Express multi-user blogging API backed by MongoDB. A client reaches the server, which mounts authentication, post, and comment routes; route handlers apply JWT authentication where configured, use Mongoose models, and return API responses. The sampled implementation supports registration/login, post listing and creation, post likes, and comments. User profiles are represented in the User model, but no profile-management route appears in the repository tree. Relationships below follow the sampled calls and server wiring; MongoDB is the documented persistence service.
Main entry points: server.js Express server · auth.js Authentication routes · posts.js Post routes · comments.js Comment routes
Components 13
API entry
- Express server
server.js
API features
- Authentication routes
routes/auth.js - Post routes
routes/posts.js - Comment routes
routes/comments.js - JWT middleware
middleware/auth.js
Data layer
- User model
models/User.js - Post model
models/Post.js - Comment model
models/Comment.js - DB connection
config/db.js
Other components
- API client
- MongoDB
- Password hashing
- JWT library
Connections 14
- API client → Express server: sends requests
server.js - Express server → DB connection: connects database
server.js - DB connection → MongoDB: opens connection
config/db.js - Express server → Authentication routes: mounts routes
server.js - Express server → Post routes: mounts routes
server.js - Express server → Comment routes: mounts routes
server.js - Authentication routes → User model: queries and saves
routes/auth.js - Authentication routes → Password hashing: hashes passwords
routes/auth.js - Authentication routes → JWT library: signs tokens
routes/auth.js - Post routes → JWT middleware: guards writes
routes/posts.js - Post routes → Post model: queries and saves
routes/posts.js - Comment routes → JWT middleware: guards creation
routes/comments.js - Comment routes → Comment model: queries and saves
routes/comments.js - JWT middleware → JWT library: verifies tokens
middleware/auth.js