How kuldeeprec/weggsapi works
Main components
• API Server: Represented by the entry points (app.js and index.js) that bootstrap the server.
• Routes: Group the route files (Admin.js, Order.js, Payment.js, Product.js, User.js, WhereToBuy.js) into a “Routes” block. These components direct incoming HTTP requests to the proper controllers.
• Middlewares: Create a component labeled “Middlewares” that includes functions like bigPromise, verifyJwtToken, and whereClause. These sit between the requests and the controllers for tasks such as authentication, error-handling, or request validation.
• Models: Setup a “Models” component that contains database schema representations (order, otp, product, user, wheretobuy). This block implies linkages with a database.
• External Dependencies: Although not explicitly detailed in the tree, note the presence of package.json which implies third-party dependencies (for example, express, jwt libraries for token verification, etc.). Optionally, add an “External Services” block for services such as payment gateways if they are integrated (inferred from the paymentController and Payment route).
Relationships and interactions
• Client-side interactions initiating HTTP requests that hit the Routes layer.
• Middleware functions should be shown intercepting requests before they reach the controllers. Illustrate these as filters or checkpoints between the Routes block and Controllers.
Architectural patterns and design principles
• Separation of concerns: Routes (request routing), Controllers (business logic), Middlewares (pre/post processing like JWT verification), and Models (data access).
• That the system is designed around modularity, where different endpoints (admin, order, payment, product, user, wheretobuy) are handled independently.