backend API for Devcamper , application to manage bootcamps, courses reviews, users and authentication.
Documentation site -> Documentation
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=
Bootcamps CRUB functionality
Fetch all bootcamps from database. Includes pagination ,filtering etc.
Endpoint:
Method: GET
Type:
URL: {{URL}}/api/v1/bootcamps
Get single bootcamp by id.
Endpoint:
Method: GET
Type:
URL: {{URL}}/api/v1/bootcamps/1
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
}
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
}
delete bootcamp from database.
Endpoint:
Method: DELETE
Type:
URL: {{URL}}/api/v1/bootcamps/637dbb0228222d4a245e0357
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 |
Create, read , update and delete the 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 |
Get the specific courses of a bootcamp by bootcamp id.
Endpoint:
Method: GET
Type:
URL: {{URL}}/api/v1/bootcamps/5d713a66ec8f2b88b8f830b8/courses
Get a single course by ID .
Endpoint:
Method: GET
Type:
URL: {{URL}}/api/v1/courses/5d725a4a7b292f5f8ceff7891
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
}
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"
}
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"
}
Routes for user authentication including register, login , reset password ,etc
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"
}
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"
}
Endpoint:
Method: GET
Type:
URL: {{URL}}/api/v1/auth/me
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json | JSON Type |
Generate password token and send email.
Endpoint:
Method: POST
Type: RAW
URL: {{URL}}/api/v1/auth/forgotpassword
Body:
{
"email" : "[email protected]"
}
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"
}
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"
}
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"
}
clear token cookie
Endpoint:
Method: GET
Type:
URL: {{URL}}/api/v1/auth/logout
CRUD functionality for users only available to admins
Get all users (admin)
Endpoint:
Method: GET
Type:
URL: {{URL}}/api/v1/users
get single user by id (admin)
Endpoint:
Method: GET
Type:
URL: {{URL}}/api/v1/users/5c8a1d5b0190b214360dc040
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"
}
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"
}
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 |
Manage course reviews
Get all reviews from database and populate with bootcamp name and description
Endpoint:
Method: GET
Type:
URL: {{URL}}/api/v1/reviews
Fetch the reviews for a specific bootcamp
Endpoint:
Method: GET
Type:
URL: {{URL}}/api/v1/bootcamps/5d725a1b7b292f5f8ceff788/reviews
Fetch a review from database by id and populate Bootcamp name and description
Endpoint:
Method: GET
Type:
URL: {{URL}}/api/v1/reviews/5d7a514b5d2c12c7449be027
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
}
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"
}
Remove review from database
Endpoint:
Method: DELETE
Type:
URL: {{URL}}/api/v1/reviews/63981d7588ea816ee43d2f9e
Generated at 2022-12-14 19:23:47 by docgen