Coder Social home page Coder Social logo

devvspaces / eduhub Goto Github PK

View Code? Open in Web Editor NEW
10.0 2.0 11.0 880 KB

An open-source educational platform that provides access to a wide range of courses and learning materials. EduHub should support features like user profiles, course creation, progress tracking, quizzes, and discussions.

License: Apache License 2.0

JavaScript 84.76% HTML 3.49% SCSS 10.33% CSS 1.42%
hacktoberfest

eduhub's Introduction

EduHub

An open-source educational platform that provides access to a wide range of courses and learning materials. EduHub should support features like user profiles, course creation, progress tracking, quizzes, and discussions.

Environment Files

  • Every project has some special content that is not displayed to public. These "secrets" are usually placed inside the environment file of the project.
  • Since backend and frontend of a project are supposed to be loosely coupled projects, both of them have their own environment file as described below.

Frontend Environment

Create a .env file in the frontend root folder and add following variables with there corresponding appropriate values

Backend Environment

Create a .env file in the backend root folder and add following variables with there corresponding appropriate values

MONGODB_URL="<mongodb-database-connection-url-here>"
PORT=<port-on-which-the-backend-runs>
JWT_SECRET="<secret-string-used-to-sign-the-authentication-tokens-used-for-logged-in-users>"
FRONTEND_URL="<url-of-the-frontend-which-requires-cors-access-once-deployed>"

Installation

Frontend

To run the Frontend locally, follow these steps:

  1. Clone the repository:

    git clone https://github.com/devvspaces/EduHub.git
  2. Navigate to the project directory:

    cd EduHub/frontend
  3. Install dependencies:

    npm install
  4. Start the development server:

    npm start
  5. Open your web browser, if it didn't lauch automatically, and visit http://localhost:3000 to access the application.

Backend

To run the Backend locally, follow these steps:

  1. Clone the repository:

    git clone https://github.com/devvspaces/EduHub.git
  2. Navigate to the project directory:

    cd EduHub/backend
  3. Install dependencies:

    npm install
  4. Start the development server:

    node server.js

    OR, If you have nodemon installed, simply run "nodemon" in the command prompt.

    nodemon 
  5. Open your web browser and visit http://localhost:3000 to access the application.

Mobile

To run the Mobile locally, follow these steps:

  1. Clone the repository:

    git clone https://github.com/devvspaces/EduHub.git
  2. Navigate to the project directory:

    cd EduHub/mobile
  3. Install project dependencies:

    flutter pub get
  4. Run the app:

    flutter run

eduhub's People

Contributors

arun-cn avatar devvspaces avatar evidence-codes avatar favourty avatar kiran-alex avatar musoye avatar orunto avatar vihar-s1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

eduhub's Issues

Create Controllers for course

create course controller

The file should be under controller/course.js

The schema contain - course_id, title, description, user_id(instructor)

  • create a function createCourss that creates a new course
    This function will accept the request object. The title and user_id must be present. If user_id not a user return 404 with error no user found else return the missing object with status code 400. If everything is okay, Create the new course with new id(course_id) and return status code 201 with new object created.

  • create a function getCourses that get all courses in the database. return status code 200 with all the courses.

  • create a function getCourse that get a course with a particular ID. The ID will be part of the url(params). If course not found return 404 with error course not found. If okay, return the course with 200 statuscode

  • create a function UpdateCourse that update a course with a particular ID. The ID will be part of the url(params). If course not found return 404 with error course not found. If found take the request object and update it accordingly and return the new record with status code 200

  • create a function deleteCourse that get a course with a particular ID. The ID will be part of the url(Paramus). If course not found return 404 with error course not found. IF okay Then delete this course and return 200 with details of course deleted

POST - createCourse, updateCourse
GET - getCourses, getCourse, deleteCourse

routes

/courses - createCourse, getCourses
/courses/:course_id - getCourse, deleteCourse, updateCourse

Import this into and create the routes in routes/course.js then include it in server.js. Test everything if possible. Write an automated testing for testing each endpoints in course_test.py/.js

Set a mongodb database

Setting up mongodb database

Under the utils create db.js and setup mongodb in it.
create a new folder under backend called models. Setup all database models with db.js set up with each collection being a file ẹ.g user collection will be under models/user.js.

The collection/database schema is in model.png

create contoller for lessons under courses

create lesson controller

The file should be under controller/lesson.js

The schema contain - lesson_id, course_id, title, content

  • create a function createLesson that creates a new
    This function will accept the request object and every rows must be
    Present else return the missing object with status code 400. if the course_id does not signify any course return 404 with error course not found. If everything is okay, Create the new lesson with new id(lesson_id) and return status code 201 with new object created.

  • create a function getLessons that get all Lessons in the database. return status code 200 with all the Lessons.

  • create a function getLesson that get a Lesson with a particular ID. The ID will be part of the url(params). If Lesson not found return 404 with error Lesson not found. If okay, return the Lesson with 200 statuscode

  • create a function updateLesson that get a Lesson with a particular ID. The ID will be part of the url(params). If Lesson not found return 404 with error Lesson not found. If found take the request object and update it accordingly and return the new record with status code 200

  • create a function deleteLesson that get a user with a particular ID. The ID will be part of the url(params). If Lesson not found return 404 with error Lesson not found. Then delete this Lesson and return 200 with details of Lesson deleted

POST - createLesson, updateLesson
GET - getLessons, getLesson , deleteLesson

routes

/lessons -> creatLesson, getLesson
/lessonss/:lesson_id -> getLesson, deleteLesson, updateLesson

Import this into and include the routes in routes/lesson.js then include it in sever.js.
Test everything if possible.(Optional: Write an automated testing for testing each endpoints in lesson_test.py/.js)

Create controllers for user.

create user controller

The file should be under controller/user.js

The schema contain - user_id, email, password, role(student, instructor, admin)

  • create a function createUser that creates a new user
    This function will accept the request object and every rows must be present else return the missing object with status code 400. If everything is okay, Create the new user with new id(user_id) and return status code 201 with new object created.
  • create a function getUsers that get all users in the database. return status code 200 with all the users.
  • create a function getUser that get a user with a particular ID. The ID will be part of the url(params). If user not found return 404 with error user not found. If okay, return the user with 200 statuscode
  • create a function updateUser that get a user with a particular ID. The ID will be part of the url(params). If user not found return 404 with error user not found. If found take the request object and update it accordingly and return the new record with status code 200
  • create a function deleteUser that get a user with a particular ID. The ID will be part of the url(params). If user not found return 404 with error user not found. Then delete this user and return 200 with details of user deleted

POST - createUser, updateUser
GET - getUsers, getUser , deleteUser

routes

/users -> creatUser, getUsers
/users/:user_id -> getUser, deleteUser, updateUser

Import this into and include the routes in routes/user.js then include it in sever.js.
Test everything if possible.(Optional: Write an automated testing for testing each endpoints in user_test.py/.js)

Create and Implement login endpoint

Implementing Login Endpoint in Express using JWT

Description

Create an Express.js endpoint for user login, using JSON Web Tokens (JWT) for authentication. This login functionality will provide a secure authentication mechanism for user sessions.
POST /login

Tasks

  • Implement a route for user login that verifies the provided credentials and generates a JWT for authenticated users. This should be under controller
  • Create a middleware function to verify the JWT for protected routes. create a directory middleware and implement the function in auth.js
  • Test the login endpoint using tools like Postman or curl.
  • Document the implementation process and provide usage examples.

Related Links

Login page

email and password are required for login
jwt is used as an authentication mechanism, make provisions for that

Create Controller for UserAssessment

User Assessment Controller README

Schema for user_assessment table:

  • user_id (ID of the user)
  • assessment_id (ID of the assessment)
  • score (the score achieved in the assessment)

Create User Assessment Controller

  1. Create a User Assessment

    Create a new controller named userAssessment.js to manage user assessments. Implement a function createUserAssessment that allows the creation of a new user assessment. This function should accept the request object. Ensure that all required fields, including user_id, assessment_id, and score, are present; otherwise, return a response with a status code of 400 indicating the missing object. If everything is in order, create the new user assessment with a new ID (user_assessment_id) and return a response with a status code of 201 along with the details of the newly created user assessment.

  2. Get All User Assessments

    Create a function getAllUserAssessments that retrieves all user assessments from the database and returns a response with a status code of 200, along with the list of user assessments.

  3. Get User Assessment by ID

    Implement a function getUserAssessmentById that retrieves a user assessment with a specific user_assessment_id. The user_assessment_id will be part of the URL parameters. If the user assessment is not found, return a response with a status code of 404 and an error message indicating "User assessment not found." If the user assessment exists, return it with a status code of 200.

  4. Update User Assessment

    Create a function updateUserAssessment that allows the modification of a user assessment with a specific user_assessment_id. The user_assessment_id will be part of the URL parameters. If the user assessment is not found, return a response with a status code of 404 and an error message indicating "User assessment not found." If the user assessment is found, take the request object and update the user assessment accordingly, and return the updated record with a status code of 200.

  5. Delete User Assessment

    Implement a function deleteUserAssessment to delete a user assessment with a specific user_assessment_id. The user_assessment_id will be part of the URL parameters. If the user assessment is not found, return a response with a status code of 404 and an error message indicating "User assessment not found." After successfully deleting the user assessment, return a response with a status code of 200, along with details of the deleted user assessment.

HTTP Methods for Endpoints:

  • POST: For createUserAssessment and updateUserAssessment.
  • GET: For getAllUserAssessments and getUserAssessmentById.
  • DELETE: For deleteUserAssessment.

Routes:

  • /user_assessments: For createUserAssessment (POST) and getAllUserAssessments (GET).
  • /user_assessments/:user_assessment_id: For getUserAssessmentById (GET), updateUserAssessment (POST), and deleteUserAssessment (DELETE).

Please follow these guidelines to create the userAssessment controller, routes, and integrate them into your server.js. Additionally, consider implementing automated tests to verify the functionality of each endpoint.

Set backend/api

set the api directory

The backend should be inside the newly created backed in directory folder.
Then there should be a folder for each of the following controllers, utils, routes and a file seerver.js
Set up express in server.js

create contoller for user-courses

create user_courses controller

The file should be under controller/user_courses.js

The schema contain - user_id, course_id

  • create a function createCourseForUser that creates a new course for user.
    This function will accept the request object and if user_id not a user return a 404 error user not found and if course_id is not course return 404 course not found. If everything is okay, Create the new course for a user and return status code 201 with new object created.

  • create a function getUserCourses that get all courses for a particular user with a user_id in the database. return status code 200 with all the courses.

  • create a function getCoursesUser that get all users for a particular course with a particular course_id. The ID will be part of the url(params). If okay, return the user with 200 statuscode

  • create a function deleteUserCourse. Check if user exist else return 404 with error user not found. This id get a course with a particular course_id. The ID will be part of the url(params). If course not found return 404 with error course not found. Then delete this course for this user and return 200 with details of course and user_id deleted

POST - createCourseForUser, deleteUserCourse
GET - getCoursesUser , getUserCourses

routes

/user-courses/:user_id -> getUserCourses
/:course_id/users/ -> createCourseForUser, deleteUserCourse
/:user_id/courses/:course_id -> getCoursesUser

Import this into and include the routes in routes/user_courses.js then include it in server.js.
Test everything if possible.(Optional: Write an automated testing for testing each endpoints in user_courses_test.py/.js)

Forget password flow

  • Create a page for initiating password reset using email
  • Create a page that retrieves the forget password token from the URL and calls the API to verify it, if valid then redirect the user to the reset password page
  • Create a reset password page
  • Integrate API for the forget password page
  • Integrate API to verify the password token page
  • Integrate API for resetting password page

create assessment/assignment collection

create assessment controller

The file should be under controller/assessment.js

The schema contain - assessment_id, course_id, title, description, type(test, exam, assignment)

  • create a function createAssessment that creates a new assessment
    This function will accept the request object and every rows must be
    Present else return the missing object with status code 400. If everything is okay, Create the new assessment with new id(assessment_id) and return status code 201 with new object created.

  • create a function getAssessments that get all assessments in the database. return status code 200 with all the assessments.

  • create a function getAssessment that get an assessment with a particular ID. The ID will be part of the url(params). If assessment not found return 404 with error assessment not found. If okay, return the assessment with 200 statuscode

  • create a function updateAssessment that get a assement with a particular ID. The ID will be part of the url(params). If assessment not found return 404 with error assessment not found. If found take the request object and update it accordingly and return the new record with status code 200

  • create a function deleteAssessment that get an assessment with a particular ID. The ID will be part of the url(params). If user not found return 404 with error assesssment not found. Then delete this user and return 200 with details of assessment deleted

POST - createAssessment, updateAssessment
GET - getAssessments, getAssessment , deleteAssessment

routes

/assessments -> creatUser, getUsers
/assessments/:assessment_id -> getUser, deleteUser, updateUser

Import this into and include the routes in routes/assessment.js then include it in sever.js.
Test everything if possible.(Optional: Write an automated testing for testing each endpoints in assessment_test.py/.js)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.