-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreadme.html
More file actions
70 lines (70 loc) · 3.49 KB
/
readme.html
File metadata and controls
70 lines (70 loc) · 3.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
About this work
<br>
This is the API for the test Elearning site am working on. This site is to show my learning of Backend with JavaScript i.e Node.JS. To the best of my learning I am building to have an Industry standard working API that I would be consuming with JavaScript framework.
<br>
The framework and package I will/am using include MongoDB, Express, Mongoose
<br>
Installation
<br>
Installing is done with the npm install command but before that you must have node installed, to check use
<br>
$ node -v
$ npm -v
<br>
this would give you the version of the node you have installed and that of its package manager
<br>
Usage
<br>
$ npm install
$ node app.js
<br>
Method | Route | Description
<br>
POST | {{baseURL}} | firstName, lastName, email, password are required
GET | {{baseURL}} | this returns all users details
PUT | {{baseURL}}/:id | this takes data to be edited with userID
DELETE | {{baseURL}}/:id | this takes the userID to be deleted
<br>
POST | {{baseURL}}/courses/ | title, description, durationPerQuestion, totalQuestion, headline, price are required
GET | {{baseURL}}/courses/ | this returns all courses
PUT | {{baseURL}}/courses/:id | this takes data to be edited with courseID
DELETE | {{baseURL}}/courses/:id | this takes the courseID to be deleted
<br>
POST | {{baseURL}}/courses/:id/article | title, body, section are required with courseID
GET | {{baseURL}}/courses/:id/article | this returns article with the courseID
PUT | {{baseURL}}/article/:idA | this takes data to be edited with articleID
DELETE | {{baseURL}}/article/:idA | this takes the articleID to be deleted
<br>
POST | {{baseURL}}/courses/:id/question| question, option1 - option4, correctAnswer, courseID are required
GET | {{baseURL}}/courses/:id/question| this returns question with the courseID
PUT | {{baseURL}}/question/:idQ | this takes data to be edited with questionID
DELETE | {{baseURL}}/question/:idQ | this takes the questionID to be deleted
<br>
POST | {{baseURL}}/application | this takes the courseID the user wants to register for
DELETE | {{baseURL}}/application/:id | this takes the courseID to be removed from user
<br>
Futher Explaination
<br>
The {{baseURL}} changes depending on the user of the API and the route that would be available to the user. On local host the {{baseURL}} for normal user is localhost:2020, for tutor is localhost:2020/tutor/, for admin is localhost:2020/admin/ and for custom service is localhost:2020/cs/.
<br>
Version 1.0
<br>
The root user is still at index.js and no user role is implemented yet. This is still to test all API call to the route and may sure they carry out what is needed. In this version the routes that are working fine are
<br>
post, get | {{baseURL}}
put, delete | {{baseURL}}/:id
post, get | {{baseURL}}/courses
put, delete | {{baseURL}}/courses/:id
post, get | {{baseURL}}/courses/:id/article
put, delete | {{baseURL}}/article:idA
post, get | {{baseURL}}//courses/:id/question
put, delete | {{baseURL}}/question/:idQ
post | {{baseURL}}/application
delete | {{baseURL}}/application/:id
<br>
This route is still under development to meet up with up with the version 1.0
<br>
This route are upcoming route for version 1.0
<br>
Route for tutor to see all the student who enrolled for the course
Route for tutor to see all the course they have