How enes-sen/backend-blog works
This is a small Express/Mongoose blog API. Clients send post and comment requests through the router; controllers perform CRUD operations through Post and Comment models and return JSON responses. Comments are associated with posts, and the server connects to MongoDB before listening. The excerpts show route dispatch, controller-to-model calls, and connection setup; they do not show the database’s runtime behavior beyond that connection.
Main entry points: routes.js API routes · comentcontroller.js Comment operations · index.js Express server · commentroutes.js Comment routes
Components 9
API runtime
- Express server
index.js - API routes
router/routes.js - Comment routes
router/commentroutes.js
Blog operations
- Post operations
controllers/blogcontroller.js - Comment operations
controllers/comentcontroller.js
Data persistence
- Post model
models/post.js - Comment model
models/comment.js - MongoDB
Other components
- API client
Connections 9
- API client → API routes: sends requests
router/routes.js - Express server → API routes: mounts routes
index.js - API routes → Post operations: dispatches posts
router/routes.js - API routes → Comment routes: mounts comments
router/routes.js - Comment routes → Comment operations: dispatches comments
router/commentroutes.js - Post operations → Post model: reads and writes
controllers/blogcontroller.js - Comment operations → Post model: reads and updates
controllers/comentcontroller.js - Comment operations → Comment model: creates and deletes
controllers/comentcontroller.js - Express server → MongoDB: connects to
index.js