StudyNotion - Backend API
StudyNotion is a backend service for an e-learning platform, built using Node.js, Express.js, and MongoDB. It follows the MVC (Model-View-Controller) architecture for better code organization and maintainability. The API has been tested using Postman.
Features
User authentication with JWT (Login, Signup, Role-based access)
Course creation, updating, and deletion
Enrollment management
Secure file storage (Cloudinary/AWS S3 integration)
Error handling and logging
Follows MVC Architecture for structured code
Tech Stack
Backend: Node.js, Express.js, MongoDB, Mongoose
Authentication: JWT (JSON Web Token)
Storage: Cloudinary/AWS S3 (for file uploads)
API Testing: Postman
Architecture: MVC (Model-View-Controller)
Installation & Setup
Prerequisites
Make sure you have the following installed:
Node.js (v14 or later)
MongoDB (local or Atlas instance)
Steps to Run Locally
Clone the repository:
git clone https://github.com/Priyanshu282002/server-StudyNotion.git cd server-StudyNotion
Install dependencies:
npm install
Create a .env file and add environment variables:
PORT=4000 MONGO_URL=your_mongodb_connection_string JWT_SECRET=your_jwt_secret CLOUDINARY_CLOUD_NAME=your_cloudinary_name CLOUDINARY_API_KEY=your_cloudinary_api_key CLOUDINARY_API_SECRET=your_cloudinary_api_secret
Start the server:
node index.js
The API will be available at http://localhost:4000
API Endpoints
Authentication Routes (/api/auth)
POST /signup - Register a new user
POST /login - Login and get JWT token
GET /profile - Fetch user profile (protected route)
Course Routes (/api/courses)
GET / - Get all courses
POST /create - Create a new course (Admin only)
PUT /update/:id - Update course details (Admin only)
DELETE /delete/:id - Delete a course (Admin only)
Enrollment Routes (/api/enrollments)
POST /enroll - Enroll in a course
GET /my-courses - Get enrolled courses for a user