Skip to content

om272004/course-selling-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧑‍🏫 Course Selling API

A basic backend project built using Node.js, Express, and MongoDB to simulate an online course selling platform.

🚀 Features

  • User and Admin authentication using JWT
  • Role-based access control (Admin/User)
  • Course creation (admin only)
  • Course purchase (user only)
  • MongoDB for data storage
  • Protected routes via middleware
  • Postman tested endpoints

🔧 Tech Stack

  • Node.js
  • Express
  • MongoDB (Compass)
  • Mongoose
  • JSON Web Tokens (JWT)

📦 Installation

  1. Clone the repo:

    git clone https://github.com/om272004/course-selling-api.git
    cd course-selling-api
    
  2. Install dependencies:

    npm install
    
  3. Update MongoDB URL:

    • Open index.js and paste your MongoDB connection string in the appropriate section where it says MONGO_URI.
  4. Run the server:

    node index.js
    

📫 API Endpoints

Method Route Access Description
POST /users/signup Public Register as a user
POST /users/login Public Login as a user
GET /users/courses User View all courses
POST /users/courses/:courseId User Purchase a course
GET /users/purchasedCourses User View purchased courses
POST /admin/signup Public Register as an admin
POST /admin/login Public Login as an admin
POST /admin/courses Admin Create a course
GET /admin/courses Admin View all courses

Author

made by om.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published