본문 바로가기

express

Udemy course spec/APIs

Courses

List all courses in the database

- Pagination

- Select specific fields(category) in result

- Limit number of results

- Filter by fields

Search Course by user input

Get single course

Create new course

- Authenticated users only

- Must have the role "instructor"

- Field validation via Mongoose

- Photo will be uploaded to local filesystem(required:false)

Update course

- Instructor only

- Validation on update

Delete courese

- Instructor only

Course API

Get all Courses / GET {{URL}}/api/v1/courses

: Fetch all courses from database includes pagination, filtering, etc

 

Get single course / GET {{URL}}/api/courses/:courseId

: Get single course by ID

 

Create new course / POST {{URL}}/api/v1/courses

: Add new course to database. Must be authenticated and must be instructor.

Header: { Content-Type: application/json, Authorization: Bearer ~~ }

Body: { requiredField1: 'a', requiredField2: 'b' }

 

Update course / PUT {{URL}}/api/v1/courses/:courseId

: Update single course in database

Header: { Content-Type: application/json, Authorization: Bearer ~~ }

Body: { editingField: 'new value' }

 

Delete course / DELETE {{URL}}/api/v1/courses/:courseId

: Delete course from database

Header: { Authorization: Bearer ~~ }

 

 

_13.may

'express' 카테고리의 다른 글

UdemyAPI_Define model schema  (0) 2020.05.13
"Udemy" API by myself  (0) 2020.05.13
How to manage of 1:N relationship? mongoose  (0) 2020.05.12
The process error handling  (0) 2020.05.11
회원 가입  (0) 2020.05.03