this is a Backend of course selling web application that enables users to buy and sell courses. It provides a add courses, user authentication, and facilitating course purchases.
- User and Admin authentication using JWT tokens
- Add courses (Admin only)
- User signup, login, and course purchase
- View purchased courses by users
- MongoDB database integration
- Express server with token-based authentication
- Node.js
- Express.js
- MongoDB (via Mongoose)
- JSON Web Tokens (JWT)
- Zod
Make sure you have the following installed:
- Node.js
- npm (Node Package Manager)
- MongoDB
Clone the repository:
git clone https://github.com/satishsurani/Course-selling-website-Backend-Server/
cd Course-selling-website-Backend-Server
npm install
Create a config Folder and inside a folder create a two file name 'jwtconfig.js' nad 'dbconfig.js'
module.exports = 'MONGO_CONNECTION_URL';
module.exports = 'YOUR_JWT_SECRET';
node index.js
or
npx nodemon index.js
The application should now be running on http://localhost:3000.
- db : Mongoose Schema Defined.
- middleware : Contains authentication middleware using JWT.
- routes/admin : Defines the API routes for signup, login, create courses, and getting all courses.
- routes/user : Defines the API routes for signup, login, getting all courses which are published, buying a particular course, and getting all purchased courses.
- Admin routes:
Method | End-point | Description |
---|---|---|
POST |
/admin/signup |
Signup as a new admin |
POST |
/admin/signin |
login as existing admin |
GET |
/admin/courses |
List all course |
POST |
/admin/courses |
Create a specific course |
- User routes:
Method | End-point | Description |
---|---|---|
POST |
/user/signup |
Signup as a new user |
POST |
/user/signin |
login as existing user |
GET |
/user/courses |
Get all published course |
POST |
/user/courses:courseId |
Purchase a specific course |
GET |
/purchasedCourses |
List all purchased course |
Feel free to contribute to this project, report issues, or suggest improvements. Happy coding!