-
- Amal Almomani
-
- Osama Mousa
-
- Reham Al-Sobh
-
- Hammad Ali
-
What is edusavior ? It's a website that helps (students) to select any course that interesting about it. And the student has the ability to add it to his/her dashboard, these courses can be attended remotely using video stream.
-
Also, you can sign on this website as a member of the instructional team so you have the ability to add your own courses and assignments that related to that course and the student can upload their answer.
-
Also, the members can communicate with each other.
-
finally, there are alots of information about the flow and the functionality for our website in our UML and Wireframe.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
- Get code
git clone https://github.com/edusavior/edusavior.git
- Get dependencies
npm i dotenv base-64 bcryptjs body-parser cors debug devcert dotenv express googleapis jsonwebtoken mongoose morgan node-fetch superagent
npm i -D eslint jest jsdoc
- create .env file
-
MONGODB_URI=mongodb://localhost:27017/edusavior
-
CLIENT_ID => for google app
-
CLIENT_SECRET => for google app
-
API_SERVER=http://localhost:3000/oauth => redirect url
-
CLIENT_ID_LN => for linkedin app
-
CLIENT_SECRET_LN => for linked in app
-
API_REQ=https://api.linkedin.com/v2/me
-
if you need any extra information visit (google & linkedIn) for developers and read documentaion .
- Start Node Server
nodemon
node index.js
The user schema holds the following information:
- A required and unique username string.
- A required and unique email string.
- A required password string.
- A required role string.
Creates a new user profile and returns a unique token that the user must then pass to reach the other endpoints.
-
sending
-
body :
{ "username":"Reham", "password":"9", "role":"instructor", "email":"rehamalsobh96@gmail.com" }
-
headers:.....
-
-
response
{ "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhbGdvcml0aG0iOiJSUzM4NCIsInVzZXJuYW1lIjoiUmVoYW0iLCJyb2xlIjoiaW5zdHJ1Y3RvciIsImNhcGFiaWxpdGllcyI6WyJyZWFkIiwiYWRkY291cnNlIl0sImlhdCI6MTU5Mjk4Mjg0Mn0.qWs9SfK3lA6BXNGjWeEnhATugj4gO0tg994jNwqdGTg" }
- verify email if you send wrong email
-
sending
-
body :
{ "username":"Reham", "password":"9", "role":"instructor", "email":"rehamcvs@gmail.com" }
-
headers:.....
-
-
response
{ The mailbox doesn't exist. }
Allows existing users to log in and returns a unique token that the user must then pass to reach the other endpoints.
-
sending
-
body : ---
-
headers:
- basic Auth
- username : Reham
- password : 9
- basic Auth
-
-
response
{"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhbGdvcml0aG0iOiJSUzM4NCIsInVzZXJuYW1lIjoiUmVoYW0iLCJyb2xlIjoiaW5zdHJ1Y3RvciIsImNhcGFiaWxpdGllcyI6WyJyZWFkIiwiYWRkY291cnNlIl0sImlhdCI6MTU5Mjk4MzA1Mn0.uCTIhz9HxwHmwXpuZl69yhCq3ta8q-nAkJVMa0AdN14", "user": { "role": "instructor", "courses": [], "questions": [], "_id": "5ef2fd39c41c2b024c545b92", "username": "Reham", "password": "$2a$05$Cm9qZOe2fxtYRpyeQz7tJuTmnLUJO8jQ6L1OspGwhHIYJGNfg6PUm", "email": "rehamalsobh96@gmail.com", "__v": 0 } }
Creates a new user profile and returns a unique token that the user must then pass to reach the other endpoints.
-
Response
``` { "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhbGdvcml0aG0iOiJSUzM4NCIsInVzZXJuYW1lIjoiUmVoYW0gQUwtU29iaCIsInJvbGUiOiJzdHVkZW50IiwiY2FwYWJpbGl0aWVzIjpbInJlYWQiXSwiaWF0IjoxNTkyOTg0NjEzfQ.17CBvzfIH4L3pRUmXRzSW2o76-EUCpXWZdPIOL8kOl4", "user": { "role": "student", "courses": [], "questions": [], "_id": "5ef30425ae988c077bc340fd", "username": "Reham AL-Sobh", "password": "$2a$05$zwmBvcE6Jum/yo9ZgvHABeY8Vi2AdIg/rcgLq8ql8j.JyckR5HndK", "email": "rehamalsobh96@gmail.com", "__v": 0 } } ```
-
Response
``` { "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhbGdvcml0aG0iOiJSUzM4NCIsInVzZXJuYW1lIjoiUmVoYW0gQUwtU29iaCIsInJvbGUiOiJzdHVkZW50IiwiY2FwYWJpbGl0aWVzIjpbInJlYWQiXSwiaWF0IjoxNTkyOTg1NTcwfQ.yKrwUzMbgS8yy6fg5CQhw5w3T1fJiMiLOIPfe4K20Qw", "user": { "role": "student", "courses": [], "questions": [], "_id": "5ef307e242c2c50a6433da38", "username": "Reham AL-Sobh", "password": "$2a$05$b.NljSfihQc.uEses31mkuu/2xjO6rtJx6xPw2ZA3Q.hmOwahNQm2", "email": "email@gmail.com", "__v": 0 } } ```
The courses schema holds the following information:
- A required course_name string.
- A required subject string.
- A required instructor string.
- A required description string.
- A required literature_time string.
-
sending
- headers:
- bearer Auth
{ "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhbGdvcml0aG0iOiJSUzM4NCIsInVzZXJuYW1lIjoiUmVoYW0iLCJyb2xlIjoiaW5zdHJ1Y3RvciIsImNhcGFiaWxpdGllcyI6WyJyZWFkIiwiYWRkY291cnNlIl0sImlhdCI6MTU5Mjk4Mjg0Mn0.qWs9SfK3lA6BXNGjWeEnhATugj4gO0tg994jNwqdGTg" }
- headers:
-
response
``` { "allCourses": [ { "quiz": [], "_id": "5eee95398a4cb369de96258d", "course_name": "maths", "subject": "math", "instructor": "reham", "description": "maaaath", "literature_time": "1-2", "__v": 0 }, { "quiz": [], "_id": "5eeef71fbdacaf14fd692d2c", "course_name": "maaaaaaaaaaaaaaaaaaths", "subject": "math", "instructor": "reham", "description": "maaaath", "literature_time": "1-2", "__v": 0 } ] } ```
-
sending
-
body : ---
-
headers:
- bearer Auth
{ "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhbGdvcml0aG0iOiJSUzM4NCIsInVzZXJuYW1lIjoiUmVoYW0iLCJyb2xlIjoiaW5zdHJ1Y3RvciIsImNhcGFiaWxpdGllcyI6WyJyZWFkIiwiYWRkY291cnNlIl0sImlhdCI6MTU5Mjk4Mjg0Mn0.qWs9SfK3lA6BXNGjWeEnhATugj4gO0tg994jNwqdGTg" }
-
-
response
-
subject : html
``` { "course": [ { "quiz": [], "_id": "5ef30b9b42c2c50a6433da3a", "course_name": "html", "subject": "html", "instructor": "Reham", "description": "teach from tha basic up to heigh level ", "literature_time": "9-11 am", "__v": 0 } ] } ```
-
-
sending
- body :
{ "course_name":"html", "subject":"html", "instructor":"Reham", "description" :"teach from tha basic up to heigh level ", "literature_time" : "9-11 am", "quiz" : [] }
- headers:
- bearer Auth
{ "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhbGdvcml0aG0iOiJSUzM4NCIsInVzZXJuYW1lIjoiUmVoYW0iLCJyb2xlIjoiaW5zdHJ1Y3RvciIsImNhcGFiaWxpdGllcyI6WyJyZWFkIiwiYWRkY291cnNlIl0sImlhdCI6MTU5Mjk4Mjg0Mn0.qWs9SfK3lA6BXNGjWeEnhATugj4gO0tg994jNwqdGTg" }
- body :
-
response
{ "quiz": [], "_id": "5ef30b9b42c2c50a6433da3a", "course_name": "html", "subject": "html", "instructor": "Reham", "description": "teach from tha basic up to heigh level ", "literature_time": "9-11 am", "__v": 0 } ```
- sending
- body :
{ "course_name":"html", "subject":"html", "instructor":"Reham", "description" :"teach from tha basic up to heigh level ", "literature_time" : "9-11 am", "quiz" : [] } ```
- headers:
- bearer Auth
{ "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhbGdvcml0aG0iOiJSUzM4NCIsInVzZXJuYW1lIjoiUmVoYW0iLCJyb2xlIjoiaW5zdHJ1Y3RvciIsImNhcGFiaWxpdGllcyI6WyJyZWFkIiwiYWRkY291cnNlIl0sImlhdCI6MTU5Mjk4Mjg0Mn0.qWs9SfK3lA6BXNGjWeEnhATugj4gO0tg994jNwqdGTg" }
- body :
- response
{"role": "instructor", "courses": [ { "course_name": "html", "subject": "html", "instructor": "Reham", "description": "teach from tha basic up to heigh level ", "literature_time": "9-11 am", "quiz": [] } ], "questions": [], "_id": "5ef308be42c2c50a6433da39", "username": "Reham", "password": "$2a$05$vuLosH5xYWnmwKCx4DfvX.uJ.ICvTiubBXsrGYWEW0xSVA581NY36", "email": "rehamalsobh96@gmail.com", "__v": 0 } ```
-
sending
-
body : ---
-
headers:
- bearer Auth
{ "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhbGdvcml0aG0iOiJSUzM4NCIsInVzZXJuYW1lIjoiUmVoYW0iLCJyb2xlIjoiaW5zdHJ1Y3RvciIsImNhcGFiaWxpdGllcyI6WyJyZWFkIiwiYWRkY291cnNlIl0sImlhdCI6MTU5Mjk4Mjg0Mn0.qWs9SfK3lA6BXNGjWeEnhATugj4gO0tg994jNwqdGTg" }
-
-
response
{ "courses": [ { "course_name": "html", "subject": "html", "instructor": "Reham", "description": "teach from tha basic up to heigh level ", "literature_time": "9-11 am", "quiz": [] } ] } ```
- id : '5ef308be42c2c50a6433da39'
-
sending
-
body :
{ "username":"Reham Omar AL-Sobh", "password":"9", "role":"instructor", "email":"rehamalsobh96@gmail.com" }
-
headers:
- bearer Auth
{ "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhbGdvcml0aG0iOiJSUzM4NCIsInVzZXJuYW1lIjoiUmVoYW0iLCJyb2xlIjoiaW5zdHJ1Y3RvciIsImNhcGFiaWxpdGllcyI6WyJyZWFkIiwiYWRkY291cnNlIl0sImlhdCI6MTU5Mjk4Mjg0Mn0.qWs9SfK3lA6BXNGjWeEnhATugj4gO0tg994jNwqdGTg" }
-
-
response
{"role": "instructor", "courses": [ { "course_name": "html", "subject": "html", "instructor": "Reham", "description": "teach from tha basic up to heigh level ", "literature_time": "9-11 am", "quiz": [] } ], "questions": [], "_id": "5ef308be42c2c50a6433da39", "username": "Reham Omar AL-Sobh", "password": "9", "email": "rehamalsobh96@gmail.com", "__v": 0 } ```
The question schema holds the following information:
- A required title string.
- A required content string.
- A required comments string.
- A required timestamps true.
The answer schema holds the following information:
- A required content string.
- A required post string.
- Question routes:
- to get all question
-
sending
-
body : ---
-
headers:
- bearer Auth
{ "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhbGdvcml0aG0iOiJSUzM4NCIsInVzZXJuYW1lIjoiUmVoYW0iLCJyb2xlIjoiaW5zdHJ1Y3RvciIsImNhcGFiaWxpdGllcyI6WyJyZWFkIiwiYWRkY291cnNlIl0sImlhdCI6MTU5Mjk4Mjg0Mn0.qWs9SfK3lA6BXNGjWeEnhATugj4gO0tg994jNwqdGTg" }
- bearer Auth
-
-
response
{ [ { "answers": [], "_id": "5ef3694eecc2152440b26a30", "title": "json", "content": "what the json stand for ?", "__v": 0 }, { "answers": [], "_id": "5ef369e0ecc2152440b26a31", "title": "html", "content": "how to write a tag ?", "__v": 0 } ] } ```
- to post question
-
sending
-
body :
``` { "title":"json", "content":"what the json stand for ?" } ```
-
headers:
- bearer Auth
{ "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhbGdvcml0aG0iOiJSUzM4NCIsInVzZXJuYW1lIjoiUmVoYW0iLCJyb2xlIjoiaW5zdHJ1Y3RvciIsImNhcGFiaWxpdGllcyI6WyJyZWFkIiwiYWRkY291cnNlIl0sImlhdCI6MTU5Mjk4Mjg0Mn0.qWs9SfK3lA6BXNGjWeEnhATugj4gO0tg994jNwqdGTg" }
- bearer Auth
-
-
response
{ { "answers": [], "_id": "5ef3694eecc2152440b26a30", "title": "json", "content": "what the json stand for ?", "__v": 0 } } ```
- to get specific question
-
sending
-
body : ---
-
headers:
- bearer Auth
{ "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhbGdvcml0aG0iOiJSUzM4NCIsInVzZXJuYW1lIjoiUmVoYW0iLCJyb2xlIjoiaW5zdHJ1Y3RvciIsImNhcGFiaWxpdGllcyI6WyJyZWFkIiwiYWRkY291cnNlIl0sImlhdCI6MTU5Mjk4Mjg0Mn0.qWs9SfK3lA6BXNGjWeEnhATugj4gO0tg994jNwqdGTg" }
- bearer Auth
-
-
response
{ [ { "answers": [], "_id": "5ef3694eecc2152440b26a30", "title": "json", "content": "what the json stand for ?", "__v": 0 } ] } ```
- to get specific question
- "_id": "5ef3694eecc2152440b26a30"
-
sending
-
body :
{ "title":"css", "content":"how to change background color?" }
-
headers:
- bearer Auth
{ "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhbGdvcml0aG0iOiJSUzM4NCIsInVzZXJuYW1lIjoiUmVoYW0iLCJyb2xlIjoiaW5zdHJ1Y3RvciIsImNhcGFiaWxpdGllcyI6WyJyZWFkIiwiYWRkY291cnNlIl0sImlhdCI6MTU5Mjk4Mjg0Mn0.qWs9SfK3lA6BXNGjWeEnhATugj4gO0tg994jNwqdGTg" }
- bearer Auth
-
-
response
{ "answers": [], "_id": "5ef369e0ecc2152440b26a31", "title": "css", "content": "how to change background color?", "__v": 0 }
- to delet question
- "_id": "5ef3694eecc2152440b26a30"
-
sending
- body : ----
-
headers:
-
bearer Auth
``` { "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhbGdvcml0aG0iOiJSUzM4NCIsInVzZXJuYW1lIjoiUmVoYW0iLCJyb2xlIjoiaW5zdHJ1Y3RvciIsImNhcGFiaWxpdGllcyI6WyJyZWFkIiwiYWRkY291cnNlIl0sImlhdCI6MTU5Mjk4Mjg0Mn0.qWs9SfK3lA6BXNGjWeEnhATugj4gO0tg994jNwqdGTg" } ```
-
- body : ----
-
response
{ "status": "sucssesfully deleted" }
-
Answer routes :
- to get all answers for specific question
-
sending
-
body : ---
-
headers:
- bearer Auth
{ "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhbGdvcml0aG0iOiJSUzM4NCIsInVzZXJuYW1lIjoiUmVoYW0iLCJyb2xlIjoiaW5zdHJ1Y3RvciIsImNhcGFiaWxpdGllcyI6WyJyZWFkIiwiYWRkY291cnNlIl0sImlhdCI6MTU5Mjk4Mjg0Mn0.qWs9SfK3lA6BXNGjWeEnhATugj4gO0tg994jNwqdGTg" }
- bearer Auth
-
-
response
{ [ { "answers": [ { "_id": "5ef39880d9854e2e252d2056", "content": "use backgroud : color", "question": "5ef369e0ecc2152440b26a31", "__v": 0 } ], "_id": "5ef369e0ecc2152440b26a31", "title": "css", "content": "how to change background color?", "__v": 3 } ] } ```
- to post answer
- "id"="5ef369e0ecc2152440b26a31"
-
sending
-
body :
{ "content":"use backgroud : color" }
-
headers:
- bearer Auth
{ "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhbGdvcml0aG0iOiJSUzM4NCIsInVzZXJuYW1lIjoiUmVoYW0iLCJyb2xlIjoiaW5zdHJ1Y3RvciIsImNhcGFiaWxpdGllcyI6WyJyZWFkIiwiYWRkY291cnNlIl0sImlhdCI6MTU5Mjk4Mjg0Mn0.qWs9SfK3lA6BXNGjWeEnhATugj4gO0tg994jNwqdGTg" }
- bearer Auth
-
-
response
{ "_id": "5ef39880d9854e2e252d2056", "content": "use backgroud : color", "question": "5ef369e0ecc2152440b26a31", "__v": 0 } ```
- to update specific answer
- "_id": "5ef39880d9854e2e252d2056"
- sending
- body :
{"content":"use backgroud-color" } ``` - *headers*: - bearer Auth ``` { "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhbGdvcml0aG0iOiJSUzM4NCIsInVzZXJuYW1lIjoiUmVoYW0iLCJyb2xlIjoiaW5zdHJ1Y3RvciIsImNhcGFiaWxpdGllcyI6WyJyZWFkIiwiYWRkY291cnNlIl0sImlhdCI6MTU5Mjk4Mjg0Mn0.qWs9SfK3lA6BXNGjWeEnhATugj4gO0tg994jNwqdGTg" } ```
- response
{ "_id": "5ef39880d9854e2e252d2056", "content": "use backgroud-color", "question": "5ef369e0ecc2152440b26a31", "__v": 0 } ```
- to delet answer
- "_id": "5ef39880d9854e2e252d2056"
-
sending
-
body : ---
- headers:
- bearer Auth
{ "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhbGdvcml0aG0iOiJSUzM4NCIsInVzZXJuYW1lIjoiUmVoYW0iLCJyb2xlIjoiaW5zdHJ1Y3RvciIsImNhcGFiaWxpdGllcyI6WyJyZWFkIiwiYWRkY291cnNlIl0sImlhdCI6MTU5Mjk4Mjg0Mn0.qWs9SfK3lA6BXNGjWeEnhATugj4gO0tg994jNwqdGTg" }
-
-
response
{ "status": "sucssesfully deleted" } ```
Testing is run through jest. To test, run
npm run jest npm test
This project is licensed under the MIT License - see the LICENSE.md file for details
- Node.js
- Heroku
- Mongo
- Swagger
Special thanks to all of the Code Fellows staff