How suhaya11/backend_of_blogapp works
This is a blog-application backend exposing Express APIs for accounts and sessions, posts, reactions/comments, and reporting with admin review. The main workflow is an HTTP request entering the server, being dispatched to a route, checked against session or input rules where applicable, and handled against MongoDB-backed models before a response is returned. Authentication strategies and session verification form an internal security layer. The README provides no feature detail, so capabilities are inferred from the routes and modules; some route implementations are only partially sampled.
Main entry points: index.mjs Express server · reportRoutes.mjs Report routes · usersRoutes.mjs User routes · postRoutes.mjs Post routes
Components 22
Server and routing
- Express server
index.mjs
Accounts and access
- User routes
src/routes/usersRoutes.mjs - Local user strategy
src/stratagies/local-stratagy.mjs - Session checks
src/controllers/verifySession.mjs - Admin strategy
src/stratagies/admin-local-stratagy.mjs
Posts and reactions
- Post routes
src/routes/postRoutes.mjs - Reaction routes
src/routes/reactionRoutes.mjs
Reports and administration
- Report routes
src/routes/reportRoutes.mjs - Admin routes
src/routes/adminRoute.mjs - Admin initialization
src/controllers/initializeAdmin.mjs
Validation and persistence
- User input rules
src/schemas/inputSchema/userSchema.mjs - User records
src/schemas/mongooseSchema/userSchema.mjs - Post input rules
src/schemas/inputSchema/postSchema.mjs - Post records
src/schemas/mongooseSchema/postSchema.mjs - Comment input rules
src/schemas/inputSchema/commentSchema.mjs - Comments and votes
src/schemas/mongooseSchema/postReactionSchema.mjs - Report input rules
src/schemas/inputSchema/reportSchema.mjs - Report records
src/schemas/mongooseSchema/repostSchema.mjs - Admin input rules
src/schemas/inputSchema/adminSchema.mjs - Admin records
src/schemas/mongooseSchema/adminSchema.mjs
Other components
- HTTP client
- MongoDB
Connections 29
- HTTP client → Express server: sends request
index.mjs - Express server → User routes: mounts routes
index.mjs - Express server → Post routes: mounts routes
index.mjs - Express server → Reaction routes: mounts routes
index.mjs - Express server → Report routes: mounts routes
index.mjs - Express server → Admin routes: mounts routes
index.mjs - Express server → MongoDB: connects to
index.mjs - Express server → Admin initialization: initializes
index.mjs - Admin initialization → Admin records: creates or reads
src/controllers/initializeAdmin.mjs - User routes → User input rules: validates with
src/routes/usersRoutes.mjs - User routes → User records: queries and writes
src/routes/usersRoutes.mjs - User routes → Local user strategy: loads strategy
src/routes/usersRoutes.mjs - User routes → Session checks: checks access
src/routes/usersRoutes.mjs - Local user strategy → User records: authenticates against
src/stratagies/local-stratagy.mjs - Local user strategy → Admin records: restores admin
src/stratagies/local-stratagy.mjs - Post routes → Post input rules: validates with
src/routes/postRoutes.mjs - Post routes → Post records: queries and writes
src/routes/postRoutes.mjs - Post routes → Comments and votes: loads post activity
src/routes/postRoutes.mjs - Post routes → Session checks: checks access
src/routes/postRoutes.mjs - Reaction routes → Comment input rules: validates with
src/routes/reactionRoutes.mjs - Reaction routes → Comments and votes: queries and writes
src/routes/reactionRoutes.mjs - Reaction routes → Post records: checks post
src/routes/reactionRoutes.mjs - Reaction routes → Session checks: checks access
src/routes/reactionRoutes.mjs - Report routes → Report input rules: validates with
src/routes/reportRoutes.mjs - Report routes → Report records: queries and writes
src/routes/reportRoutes.mjs - Report routes → Comments and votes: loads comments
src/routes/reportRoutes.mjs - Report routes → Post records: reviews posts
src/routes/reportRoutes.mjs - Report routes → Session checks: checks access
src/routes/reportRoutes.mjs - Admin routes → Admin strategy: loads strategy
src/routes/adminRoute.mjs