Skip to content

Latest commit

Β 

History

History
72 lines (50 loc) Β· 2.74 KB

File metadata and controls

72 lines (50 loc) Β· 2.74 KB

πŸŽ“ Course Selling Website Backend (Something like Udemy)

Welcome to the backend of the Course Selling Platform!
This repository powers the REST APIs for both the User and Admin sides of the platform. If you have doubts about anything like JWT or anything ping me anytime !


πŸ”§ Backend Setup

πŸ“ Folder Structure


πŸ” Authentication

  • JWT tokens are issued on both user and admin login.
  • Use Authorization: Bearer <token> header to access protected routes.
  • Made a middleware in middlewares/middleware.js, named VerifyToken__ which verifies token according to the user.

πŸ“¦ Features Implemented in Backend

πŸ‘€ User Side

Go to user.js in the routes folder.

  • POST /user/signup – Register a new user.Go to user.js in the routes folder.
  • POST /user/login – Login user and receive JWT
  • POST /user/course/purchase – Purchase a course. Sending the course info via req.body.
  • GET /user/purchases – View all purchased courses

πŸ§‘β€πŸ’Ό Admin Side

Go to admin.js in the routes folder.

  • POST /admin/signup – Register a new admin
  • POST /admin/login – Login admin and receive JWT
  • POST /admin/create-course – Create a course
  • PUT /admin/update-course – Edit a course
  • GET /admin/created-courses – View all courses created by this admin
  • DELETE /admin/delete-course - To delete a course.

All courses page. Visit courses.js file in routes/

  • GET /courses – View all courses on the platform.

βœ… User Side Pages

Page Name Description
πŸ” User Signup Has four fields email, password, name, age
πŸ” User Login Has two fields email,password
πŸŽ“ Courses Display all available courses (GET /courses)
πŸ›’ My Courses Show purchased courses (GET /user/purchases)

βœ… Admin Side Pages

Page Name Description
πŸ“ Admin Signup Has four fields email, password, name, age
πŸ“ Admin Login Has two fields email,password
βž• Create Course Form to create course (POST /admin/create-course)
✏️ Edit Course Form to edit course (PUT /admin/update-course)
πŸ“„ My Created Courses Display list of courses created by admin (GET /admin/created-courses)

πŸ” All these pages must send the Authorization header with the JWT token after login.


πŸ“Œ Environment Variables