https://github.com/guptag0808/lms_backend
https://github.com/guptag0808/lms_backend
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/guptag0808/lms_backend
- Owner: guptag0808
- Created: 2024-06-13T08:41:16.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-06-15T07:55:09.000Z (12 months ago)
- Last Synced: 2025-02-08T19:33:24.625Z (4 months ago)
- Language: JavaScript
- Size: 33.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LMS Backend API
This project is a RESTful API for a Course Management System within a Learning Management System (LMS). The API supports user authentication, course management (CRUD operations), and progress tracking. It demonstrates handling databases, securing endpoints, and managing relationships between different entities.
## Table of Contents
- [Features](#features)
- [Installation](#installation)
- [Database Setup](#database-setup)
- [Usage](#usage)
- [API Endpoints](#api-endpoints)
- [Contributing](#contributing)
- [License](#license)## Features
- User Authentication (Register and Login)
- Course Management (Create, Read, Update, Delete)
- Progress Tracking for Users
- Role-based Access Control (Students and Teachers)
- JWT Authentication## Installation
1. Clone the repository:
```sh
git clone https://github.com/yourusername/lms_backend.git
cd lms_backend
```2. Install dependencies:
```sh
npm install
```## Database Setup
1. Ensure you have MySQL installed and running.
2. Create the database:
```sh
mysql -u root -p
CREATE DATABASE new_database;
```3. Run the following command to sync the models with the database:
```sh
npm start server
```## Usage
Start the server:
```sh
npm start server
```
## API Endpoints### User Authentication
POST /register: Register a new user (student or teacher)
```
{
"name": "string",
"password": "string",
"email:"string"
"role": "student" // or "teacher",
}
```
## POST /login: Authenticate a user and provide a token
```
{
"username": "string",
"password": "string"
}
```
## Course Management
### GET courses/: Retrieve a list of all courses (Authenticated users)
### GET courses/:id: Retrieve details of a specific course (Authenticated users)
### POST courses/: Create a new course (Teachers only)
### DELETE courses/:id: Delete a course (Teachers only)
```
{
"title": "string",
"description": "string"
}
```
## Progress Tracking
## GET /users/:id/progress: Retrieve progress for a specific user (Authenticated users)
## POST /users/:id/progress: Update progress for a specific user (Authenticated users)
```
{
"courseId": 1,
"enroll": true,
"status": "in progress"
}
```