How rohit2968/backend-project works
Project type and purpose
• This is a monolithic, RESTful backend service built with Node.js and Express.
• It provides JWT-based user authentication, CRUD operations (users and videos/transactions), and integrates with MongoDB and Cloudinary.
• It also exposes a public directory for temporary/static files and supports CORS.
File structure
• Top-level:
• package.json / .env.sample: dependencies and environment variables
• public/temp: a place for temporary static files (e.g., pre-upload storage)
• src/: all application code
• Within src/:
• index.js & app.js: application entry points and Express app setup
• constants.js: shared constants (e.g. status codes, env names)
• controllers/: “user.controller.js” handles request logic
• routes/: “user.routes.js” wires routes → controllers
• models/: Mongoose schemas for User and Video
• db/: “index.js” sets up MongoDB connection
• middlewares/: auth (JWT verification), multer (file upload)
• utils/: error-handling (ApiError, ApiResponse), async wrapper, Cloudinary helper
README for additional insights
• Features: JWT auth, CRUD, MongoDB, CORS
Client → Routes → Controllers → Models → Database/External Services
Detail
• Both synchronous database calls (Mongoose) and asynchronous file uploads.
• Error handling path (ApiError → middleware → response).