DevBootcampAPI

Backend API for the DevCamper application to manage bootcamps, courses, reviews, users and authentication

Bootcamps 7

Bootcamps CRUD Operations

Description

Fetch all bootcamps from database. Inlcudes pagination, filtering, etc…

Query
KeyValueDescription
page1

page number

limit2

number of items per page

Description

Fetch single bootcamp by ID

URL Variables
KeyValueDescription
id5d725a1b7b292f5f8ceff788
Description

Create new bootcamp to database. Must be authenticated and must be publisher or admin.

Body
{ "_id": "5d725a1b7b292f5f8ceff788", "user": "5c8a1d5b0190b214360dc032", "name": "Devcentral Bootcamp", "description": "Is coding your passion? Codemasters will give you the skills and the tools to become the best developer possible. We specialize in front end and full stack web development", "website": "https://devcentral.com", "phone": "(444) 444-4444", "email": "enroll@devcentral.com", "address": "45 Upper College Rd Kingston RI 02881", "careers": [ "Mobile Development", "Web Development", "Data Science", "Business" ], "housing": false, "jobAssistance": true, "jobGuarantee": true, "acceptGi": true }
Description

Update a bootcamp in database by ID. Must be authenticated and must be publisher or admin.

URL Variables
KeyValueDescription
id5d713a66ec8f2b88b8f830b8

bootcamp id

Body
{ "housing": false }
Description

Upload a bootcamp photo in database by ID. Must be authenticated and must be publisher or admin.

URL Variables
KeyValueDescription
id5d725a1b7b292f5f8ceff788

bootcamp id

Body
KeyValueDescription
photo
Description

Delete a bootcamp from database by ID. Must be authenticated and must be publisher or admin.

URL Variables
KeyValueDescription
id5d725a1b7b292f5f8ceff788

bootcamp id

Description

StartFragment

This endpoint is used to retrieve bootcamps within a specified radius of a given location (zipcode) in a particular unit of measurement. It employs the Haversine formula to calculate the distance between the specified location and the bootcamps in the database, ensuring accurate results.

EndFragment

URL Variables
KeyValueDescription
zipcode02118

The zipcode of the location from which to search for nearby bootcamps.

distance100

The distance in the specified unit (e.g., miles or kilometers) that defines the radius within which to search for bootcamps.

unitmi

The unit of measurement for the distance, either “mi” for miles or “km” for kilometers.

Courses 7

Courses CRUD Operations

Description

Fetch all courses from database. Inlcudes pagination, filtering, etc…

Query
KeyValueDescription
page3

page number

limit3

number of items per page

Description

Fetch single course by ID

URL Variables
KeyValueDescription
id5d725a4a7b292f5f8ceff789
Description

fetch all courses of specific bootcamp by bootcampId

Query
KeyValueDescription
selecttitle,bootcamp
URL Variables
KeyValueDescription
bootcampId5d725a1b7b292f5f8ceff788

bootcamp id

Description

Create new course to database. Must be authenticated and must be publisher or admin.

Body
{ "_id": "5d725cfec4ded7bcb480eaa5", "title": "Web Development", "description": "This course will teach you how to build high quality web applications with technologies like React, Node.js, PHP & Laravel", "weeks": 8, "tuition": 8000, "minimumSkill": "beginner", "scholarhipsAvailable": false, "bootcamp": "5d725a1b7b292f5f8ceff788", "user": "5c8a1d5b0190b214360dc032" }
Description

Update a course in database by ID. Must be authenticated and must be publisher or admin.

URL Variables
KeyValueDescription
id5d725cfec4ded7bcb480eaa5

bootcamp id

Body
{ "scholarhipsAvailable": false }
Description

Delete a Course from database by ID. Must be authenticated and must be publisher or admin.

URL Variables
KeyValueDescription
id5d725cfec4ded7bcb480eaa5

bootcamp id

Description

Create a course for a specific bootcamp

URL Variables
KeyValueDescription
bootcampId5d725a1b7b292f5f8ceff788
Body
{ "_id": "5d725cfec4ded7bcb480eaa5", "title": "Web Development", "description": "This course will teach you how to build high quality web applications with technologies like React, Node.js, PHP & Laravel", "weeks": 8, "tuition": 8000, "minimumSkill": "beginner", "scholarhipsAvailable": false, "user": "5c8a1d5b0190b214360dc032" }

Authentication 7

Endpoints for user authentication includes register, login, reset password, etc

Description

Add user to database with encrypted password

Body
{ "name": "John Doe", "email": "john@example.com", "password": "{{password}}", "passwordConfirm": "{{password}}", "role": "publisher" }
Description

Add user to database with encrypted password

Body
{ "email": "barry@gmail.com", "password": "{{password}}" }
Description

StartFragment

GET logged in user data

EndFragmen

Description

Generate password token and send email

Body
{ "email": "john@gmail.com" }
Description

reset user password via token

URL Variables
KeyValueDescription
resetToken0a06900986edaabc4d35fad269a3ec77b1f71729dd493634ba1d013d0ca55398

reset password token

Body
{ "password": "123456", "passwordConfirm": "123456" }
Description

Update logged in user name and email

Body
{ "name": "John Doe", "email": "john@gmail.com" }
Description

Log user out by setting clear cookie

Users 5

CRUD functionality for users only available to admin

Description

Fetch all users from database. Inlcudes pagination, filtering, etc…, Must be authenticated and must be admin.

Query
KeyValueDescription
page2

page number

limit5

number of users per page

Description

Fetch single user by ID. Must be authenticated and must be admin.

URL Variables
KeyValueDescription
id5d7a514b5d2c12c7449be043

user id

Description

Create new user in datebase. Must be authenticated and must be admin.

Body
{ "name": "user example", "email": "user@example.com", "password": "123456", "passwordConfirm": "123456" }
Description

Update a user in database by ID. StartFragment

Must be authenticated and must be admin.

EndFragment

URL Variables
KeyValueDescription
id64c21325532bf51564b2ea0b

user id

Body
{ "role": "publisher" }
Description

Delete a User from database by ID. Must be authenticated and must be admin.

EndFragment

URL Variables
KeyValueDescription
id64c21325532bf51564b2ea0b

user id

Reviews 5

Manage Course reviews

Description

Insert review for a specific bootcamp.

URL Variables
KeyValueDescription
bootcampId5d725a037b292f5f8ceff787
Body
{ "title": "Not worth the money", "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec viverra feugiat mauris id viverra. Duis luctus ex sed facilisis ultrices. Curabitur scelerisque bibendum ligula, quis condimentum libero fermentum in. Aenean erat erat, aliquam in purus a, rhoncus hendrerit tellus. Donec accumsan justo in felis consequat sollicitudin. Fusce luctus mattis nunc vitae maximus. Curabitur semper felis eu magna laoreet scelerisque", "rating": 4.5 }
Description

update user Review. Must be Authenticated and only user can update his/her review.

URL Variables
KeyValueDescription
id5d7a514b5d2c12c7449be025

review id

Body
{ "rating": 4.5 }
Description

Delete user Review. Must be Authenticated and only user can delete his/her review and also admin can do this action.

URL Variables
KeyValueDescription
id5d7a514b5d2c12c7449be025

review id

Description

Get all reviews for a specific bootcamp by passing bootcamp id.

Query
KeyValueDescription
page1
limit3
URL Variables
KeyValueDescription
bootcampId5d713995b721c3bb38c1f5d0

bootcamp id

Description

Get all reviews from database and populate with bootcamp name and description

Query
KeyValueDescription
page1
limit3