How duttaabhirupdev10/restaurant_foodapp works
This is an Express/MongoDB restaurant-management API. Clients enter through versioned routes; authentication and role checks protect selected operations, controllers implement account, restaurant, category, menu, and order actions, and Mongoose models persist the results. The README documents the broader CRUD and order-status capabilities; some corresponding source was not sampled, so those links follow the documented route/controller structure without asserting finer internal calls.
Main entry points: server.js Express server · logger.js Logging · foodRoutes.js Food routes · authMiddleware.js JWT verification
Components 25
API entry
- Express server
server.js - Auth routes
routes/authRoutes.js - User routes
routes/userRoutes.js - Restaurant routes
routes/restaurantRoutes.js - Category routes
routes/categoryRoutes.js - Food routes
routes/foodRoutes.js - Test routes
routes/testRoutes.js
Identity and access
- Authentication
controllers/authController.js - User management
controllers/userController.js - JWT verification
middleware/authMiddleware.js - Admin check
middleware/adminMiddleware.js
Restaurant catalog
- Restaurant management
controllers/restaurantController.js - Category management
controllers/categoryController.js - Menu management
controllers/foodController.js
Ordering
- Order actions
controllers/foodController.js
Persistence and support
- User records
models/userModel.js - Restaurant records
models/restaurantModel.js - Category records
models/categoryModel.js - Food records
models/foodModel.js - Order records
models/orderModel.js - DB connection
config/db.js - Error handling
utils/errorHandler.js - Logging
utils/logger.js
Other components
- API client
- MongoDB
Connections 39
- API client → Express server: sends requests
- Express server → Auth routes: mounts routes
- Express server → User routes: mounts routes
- Express server → Restaurant routes: mounts routes
- Express server → Category routes: mounts routes
- Express server → Food routes: mounts routes
- Express server → Test routes: mounts routes
- Express server → DB connection: connects database
- Express server → Error handling: installs handler
- Auth routes → Authentication: dispatches to
- User routes → JWT verification: guards routes
- User routes → User management: dispatches to
- Restaurant routes → JWT verification: guards writes
- Restaurant routes → Restaurant management: dispatches to
- Category routes → JWT verification: guards writes
- Category routes → Category management: dispatches to
- Food routes → JWT verification: guards operations
- Food routes → Admin check: guards status updates
- Food routes → Menu management: dispatches to
- Food routes → Order actions: dispatches orders
- Authentication → User records: reads and writes
- User management → User records: reads and writes
- Restaurant management → Restaurant records: reads and writes
- Category management → Category records: reads and writes
- Menu management → Food records: reads and writes
- Order actions → Order records: creates and updates
- DB connection → MongoDB: connects to
- User records → MongoDB: persists records
- Restaurant records → MongoDB: persists records
- Category records → MongoDB: persists records
- Food records → MongoDB: persists records
- Order records → MongoDB: persists records
- Express server → Logging: logs startup
- Error handling → Logging: logs errors
- Authentication → Logging: logs activity
- User management → Logging: logs activity
- Restaurant management → Logging: logs activity
- Category management → Logging: logs activity
- Menu management → Logging: logs activity