Skip to content

backend API for Devcamper , application to manage bootcamps, courses reviews, users and authentication.

Notifications You must be signed in to change notification settings

gopi-chandu/devcamp_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Devcamper API Prod

backend API for Devcamper , application to manage bootcamps, courses reviews, users and authentication.

Documentation site -> Documentation

config file in config folder -> env variables

NODE_ENV=development PORT=5000 MONGO_URI= enter yout mongo url path

FILE_UPLOAD_PATH=./public/uploads MAX_FILE_UPLOAD=1000000

JWT_SECRET= your secret JWT_EXPIRE=30d JWT_COOKIE_EXPIRE=30

SMTP_HOST= your mail provider SMTP_PORT=your mail port SMTP_EMAIL= SMTP_PASSWORD= FROM_EMAIL= FROM_NAME=

Endpoints


Bootcamps

Bootcamps CRUB functionality

1. Get all Bootcamps

Fetch all bootcamps from database. Includes pagination ,filtering etc.

Endpoint:

Method: GET
Type: 
URL: {{URL}}/api/v1/bootcamps

2. Get Single Bootcamp

Get single bootcamp by id.

Endpoint:

Method: GET
Type: 
URL: {{URL}}/api/v1/bootcamps/1

3. Create New Bootcamp

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

Endpoint:

Method: POST
Type: RAW
URL: {{URL}}/api/v1/bootcamps/

Headers:

Key Value Description
Content-Type application/json JSON Type

Body:

{
    "name": "sample test22",
		"description": "Devworks is a full stack JavaScript Bootcamp located in the heart of Boston that focuses on the technologies you need to get a high paying job as a web developer",
		"website": "https://devworks.com",
		"phone": "(111) 111-1111",
		"email": "[email protected]",
		"address": "233 Bay State Rd Boston MA 02215",
		"careers": ["Web Development", "UI/UX", "Business"],
		"housing": true,
		"jobAssistance": true,
		"jobGuarantee": false,
		"acceptGi": true
}

4. Update Single Bootcamp

update single bootcamp in database.

Endpoint:

Method: PUT
Type: RAW
URL: {{URL}}/api/v1/bootcamps/6362595ab71358d4d6aefc6a

Headers:

Key Value Description
Content-Type application/json JSON Type

Body:

{
		"housing": false

}

5. Delete Bootcamp

delete bootcamp from database.

Endpoint:

Method: DELETE
Type: 
URL: {{URL}}/api/v1/bootcamps/637dbb0228222d4a245e0357

6. Upload Photo

Route to upload a bootcamp photo

Endpoint:

Method: PUT
Type: FORMDATA
URL: {{URL}}/api/v1/bootcamps/5d725a1b7b292f5f8ceff788/photo

Headers:

Key Value Description
Content-Type application/json JSON Type

Body:

Key Value Description
file

Courses

Create, read , update and delete the courses.

1. Get All Courses

Get all courses

Endpoint:

Method: GET
Type: 
URL: {{URL}}/api/v1/courses

Headers:

Key Value Description
Content-Type application/json JSON Type

Query params:

Key Value Description
page 3
limit 3

2. Get Courses For Bootcamp

Get the specific courses of a bootcamp by bootcamp id.

Endpoint:

Method: GET
Type: 
URL: {{URL}}/api/v1/bootcamps/5d713a66ec8f2b88b8f830b8/courses

3. Get single Course

Get a single course by ID .

Endpoint:

Method: GET
Type: 
URL: {{URL}}/api/v1/courses/5d725a4a7b292f5f8ceff7891

4. Create Bootcamp Course

Create a course for specific bootcamp

Endpoint:

Method: POST
Type: RAW
URL: {{URL}}/api/v1/bootcamps/5d725a037b292f5f8ceff787/courses

Body:

{
    "title": "Random Sample",
    "description": "This course will provide you with all of the essentials to become a successful frontend web developer. You will learn to master HTML, CSS and front end JavaScript, along with tools like Git, VSCode and front end frameworks like Vue",
    "weeks": 8,
    "tuition": 8000,
    "minimumSkill": "beginner",
    "scholarshipsAvailable": false,
    "__v": 0
}

5. Update a Course

Update a course by Id in database.

Endpoint:

Method: PUT
Type: RAW
URL: {{URL}}/api/v1/courses/5d725a4a7b292f5f8ceff789

Headers:

Key Value Description
Content-Type application/json JSON Type

Body:

{
    "tuition": 9990,
    "minimumSkill": "intermediate"
}

6. Delete a Course

Delete a course from database by Id

Endpoint:

Method: DELETE
Type: RAW
URL: {{URL}}/api/v1/courses/5d725a4a7b292f5f8ceff789

Headers:

Key Value Description
Content-Type application/json JSON Type

Body:

{
    "tuition": 9990,
    "minimumSkill": "intermediate"
}

Authentication

Routes for user authentication including register, login , reset password ,etc

1. Register User

Add user to database with encrypted password

Endpoint:

Method: POST
Type: RAW
URL: {{URL}}/api/v1/auth/register

Headers:

Key Value Description
Content-Type application/json JSON Type

Body:

{
    "name":"Gopi",
    "email":"[email protected]",
    "role":"publisher",
    "password":"chandu"
}

2. Login User

Login user using username and password

Endpoint:

Method: POST
Type: RAW
URL: {{URL}}/api/v1/auth/login

Headers:

Key Value Description
Content-Type application/json JSON Type

Body:

{
    "email":"[email protected]",
    "password":"123456"
}

3. Get logged in User via Token

Endpoint:

Method: GET
Type: 
URL: {{URL}}/api/v1/auth/me

Headers:

Key Value Description
Content-Type application/json JSON Type

4. Forgot Password

Generate password token and send email.

Endpoint:

Method: POST
Type: RAW
URL: {{URL}}/api/v1/auth/forgotpassword

Body:

{
    "email" : "[email protected]"
}

5. Reset Password

Reset user password using token

Endpoint:

Method: PUT
Type: RAW
URL: {{URL}}/api/v1/auth/resetpassword/288cf19c58ee48512defa3db14a373c1f9883161

Headers:

Key Value Description
Content-Type application/json JSON Type

Body:

{
    "password": "chandu"
}

6. Update User Details

Update logged in user and email

Endpoint:

Method: PUT
Type: RAW
URL: {{URL}}/api/v1/auth/updatedetails

Headers:

Key Value Description
Content-Type application/json JSON Type

Body:

{
    "email":"[email protected]",
    "name": "Jon snow"
}

7. Update Password

Update logged in user password, send in the body currentPassword and newPassword

Endpoint:

Method: PUT
Type: RAW
URL: {{URL}}/api/v1/auth/updatepassword

Headers:

Key Value Description
Content-Type application/json JSON Type

Body:

{
    "currentPassword":"chandu",
    "newPassword":"chandu1"
}

8. Logout user

clear token cookie

Endpoint:

Method: GET
Type: 
URL: {{URL}}/api/v1/auth/logout

Users

CRUD functionality for users only available to admins

1. Get All Users

Get all users (admin)

Endpoint:

Method: GET
Type: 
URL: {{URL}}/api/v1/users

2. Get Single User

get single user by id (admin)

Endpoint:

Method: GET
Type: 
URL: {{URL}}/api/v1/users/5c8a1d5b0190b214360dc040

3. Create User

Add user to database (admin)

Endpoint:

Method: POST
Type: RAW
URL: {{URL}}/api/v1/users/

Headers:

Key Value Description
Content-Type application/json JSON Type

Body:

{
    "name":"Cersei",
    "email":"[email protected]",
    "password":"jaime1"
}

4. Update User

update user in database (admin)

Endpoint:

Method: PUT
Type: RAW
URL: {{URL}}/api/v1/users/639612dee9fa0b53197b1a74

Headers:

Key Value Description
Content-Type application/json JSON Type

Body:

{
    "name":"cersei"
}

5. Delete User

delete user from database (admin)

Endpoint:

Method: DELETE
Type: RAW
URL: {{URL}}/api/v1/users/639612dee9fa0b53197b1a74

Headers:

Key Value Description
Content-Type application/json JSON Type

Reviews

Manage course reviews

1. Get All Reviews

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

Endpoint:

Method: GET
Type: 
URL: {{URL}}/api/v1/reviews

2. Get Reviews For Bootcamp

Fetch the reviews for a specific bootcamp

Endpoint:

Method: GET
Type: 
URL: {{URL}}/api/v1/bootcamps/5d725a1b7b292f5f8ceff788/reviews

3. Get Single Review

Fetch a review from database by id and populate Bootcamp name and description

Endpoint:

Method: GET
Type: 
URL: {{URL}}/api/v1/reviews/5d7a514b5d2c12c7449be027

4. Add Review For Bootcamp

Insert review for a specific bootcamp

Endpoint:

Method: POST
Type: RAW
URL: {{URL}}/api/v1/bootcamps/6398198adf2e29ada6efb8b2/reviews

Headers:

Key Value Description
Content-Type application/json JSON Type

Body:

{
    "title":"hello",
    "text":"12345",
    "rating":3
}

5. Update Review

Update review in database

Endpoint:

Method: PUT
Type: RAW
URL: {{URL}}/api/v1/reviews/63981d7588ea816ee43d2f9e

Headers:

Key Value Description
Content-Type application/json JSON Type

Body:

{
    "title":"ha ha ha"
}

6. Delete Review

Remove review from database

Endpoint:

Method: DELETE
Type: 
URL: {{URL}}/api/v1/reviews/63981d7588ea816ee43d2f9e

Back to top

Generated at 2022-12-14 19:23:47 by docgen

About

backend API for Devcamper , application to manage bootcamps, courses reviews, users and authentication.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published