Backend API for DevCamper application, which is a bootcamp directory website
Rename "config/config.env.env" to "config/config.env" and update the values/settings to your own
npm install
# Run in dev mode
npm run dev
# Run in prod mode
npm start
To seed the database with users, bootcamps, courses and reviews with data from the "_data" folder, run
# Destroy all data
node seeder -d
# Import all data
node seeder -i
- Version: 1.0.0
- License: MIT
- Author: Vijay Kumar
Routes for using user authentication for register, login, reset password, etc.
Generate forgot password token and send an email.
Endpoint:
Method: GET
Type: RAW
URL: {{URL}}/api/v1/auth/forgotpassword
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json | JSON type |
Body:
{
"email":"mary@gmail.com"
}
getting logged in user details
Endpoint:
Method: GET
Type: RAW
URL: {{URL}}/api/v1/auth/me
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json | JSON type |
verify login credentials in database.
Endpoint:
Method: POST
Type: RAW
URL: {{URL}}/api/v1/auth/login
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json | JSON type |
Body:
{
"email":"aman@aman.com",
"password":"123456"
}
clear token cookie and logout a user.
Endpoint:
Method: GET
Type: RAW
URL: {{URL}}/api/v1/auth/logout
Endpoint:
Method: GET
Type:
URL:
Add a 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":"aman kumar",
"email":"aman@aman.com",
"password":"amankumar"
}
reset password with token
Endpoint:
Method: PUT
Type: RAW
URL: {{URL}}/api/v1/auth/resetpassword/d5b6c512cf0181dfa9e23892e76c2e9e9ed29953fbf6f1e484
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json | JSON type |
Body:
{
"password":1234566
}
update loggedin user, only name
Endpoint:
Method: PUT
Type: RAW
URL: {{URL}}/api/v1/auth/updatedetails
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json | JSON type |
Body:
{
"name": "aman",
"email": "aman@aman.com"
}
Update logged in user's password by providing currentPassword.
Endpoint:
Method: PUT
Type: RAW
URL: {{URL}}/api/v1/auth/updatepassword
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json | JSON type |
Body:
{
"currentPassword":"amankumar",
"newPassword": "123456"
}
Bootcamps CRUD functionality.
Add new Bootcampt to database. Must be authenticated. Must be Autor or Admin.
Endpoint:
Method: POST
Type: RAW
URL: {{URL}}/api/v1/bootcamps
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json | JSON type |
Authorization | Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjYwNDk5YjExYmM3N2RhMmYwY2Y2M2Q0NyIsImlhdCI6MTYxNTUwNTgwMywiZXhwIjoxNjE4MDk3ODAzfQ.r9r7ioIdShFO044TsUyHs5n0g17-wHPNLcpu3RdWD98 |
Body:
{
"name": "Test Bootcamp",
"description": "ModernTech has one goal, and that is to make you a rockstar developer and/or designer with a six figure salary. We teach both development and UI/UX",
"website": "https://moderntech.com",
"phone": "(222) 222-2222",
"email": "enroll@moderntech.com",
"address": "220 Pawtucket St, Lowell, MA 01854",
"careers": ["Web Development", "UI/UX", "Mobile Development"],
"housing": false,
"jobAssistance": true,
"jobGuarantee": false,
"acceptGi": true
}
Delete Bootcamp from database
Endpoint:
Method: DELETE
Type:
URL: {{URL}}/api/v1/bootcamps/604ab5e62625081964fcf298
Feth 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/5ff1a8f8c0586a347892ec9a
Update single Bootcamp in database.
Endpoint:
Method: PUT
Type:
URL: {{URL}}/api/v1/bootcamps/1
Route to upload a file to bootcamp.
Endpoint:
Method: PUT
Type:
URL: {{URL}}/api/v1/bootcamps/5d725a1b7b292f5f8ceff788/photo
Create, Update, Delete Courses
create a course for a specific boorcamp.
Endpoint:
Method: POST
Type: RAW
URL: {{URL}}/api/v1/bootcamps/5d713995b721c3bb38c1f5d0/courses
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json | JSON type |
Body:
{
"title": "Full Stack Web Development",
"description": "In this course you will learn full stack web development, first learning all about the frontend with HTML/CSS/JS/Vue and then the backend with Node.js/Express/MongoDB",
"weeks": 12,
"tuition": 10000,
"minimumSkill": "intermediate",
"scholarhipsAvailable": true
}
delete a course from database by id
Endpoint:
Method: DELETE
Type:
URL: {{URL}}/api/v1/courses/5d725a4a7b292f5f8ceff789
get all courses from a specific bootcamp
Endpoint:
Method: GET
Type:
URL: {{URL}}/api/v1/bootcamps/5d725a1b7b292f5f8ceff788/courses
get a single course by id
Endpoint:
Method: GET
Type:
URL: {{URL}}/api/v1/courses/5d725a4a7b292f5f8ceff789
Get all Courses in database.
Endpoint:
Method: GET
Type:
URL: {{URL}}/api/v1/courses
update a course in database with id
Endpoint:
Method: PUT
Type: RAW
URL: {{URL}}/api/v1/courses/5d725a4a7b292f5f8ceff789
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json | JSON type |
Body:
{
"weeks": 10
}
Manage course reviews.
Insert review for a specific bootcamp.
Endpoint:
Method: POST
Type: RAW
URL: {{URL}}/api/v1/bootcamps/5d725a1b7b292f5f8ceff788/reviews
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json | JSON type |
Body:
{
"title":"Nice Bootcamp",
"text":"Bootcamp is amazing",
"rating": 9
}
logged in user and admin can delete their review.
Endpoint:
Method: DELETE
Type: RAW
URL: {{URL}}/api/v1/reviews/605ca27728e52d46e8b85721
Get all reviews from database and populate it with bootcamp name and description.
Endpoint:
Method: GET
Type:
URL: {{URL}}/api/v1/reviews
get the reviews for a specific bootcamp.
Endpoint:
Method: GET
Type:
URL: {{URL}}/api/v1/bootcamps/5d725a1b7b292f5f8ceff788/reviews
get a single review from dataabase and populate it with bootcamp name and description.
Endpoint:
Method: GET
Type:
URL: {{URL}}/api/v1/reviews/5d7a514b5d2c12c7449be025
logged in users can update their review for bootcamp.
Endpoint:
Method: PUT
Type: RAW
URL: {{URL}}/api/v1/reviews/605ca27728e52d46e8b85721
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json | JSON type |
Body:
{
"title":"Good Bootcamp",
"text":"Bootcamp is amazing",
"rating": 9
}
CRUD functionality for user, only available to admins.
Create users in database by admin.
Endpoint:
Method: POST
Type: RAW
URL: {{URL}}/api/v1/users
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json | JSON type |
Body:
{
"name":"aman kumar admin",
"email":"aman@admin.com",
"password":"amankumar"
}
delete a user from database
Endpoint:
Method: DELETE
Type: RAW
URL: {{URL}}/api/v1/users/5d7a514b5d2c12c7449be045
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json | JSON type |
getting all users by admin with advanced results
Endpoint:
Method: GET
Type: RAW
URL: {{URL}}/api/v1/users
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json | JSON type |
getting single user from database by his/her id.
Endpoint:
Method: GET
Type: RAW
URL: {{URL}}/api/v1/users/60574352977b1c22f83b03a3
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json | JSON type |
update any detail of an user by admin.
Endpoint:
Method: PUT
Type: RAW
URL: {{URL}}/api/v1/users/60574352977b1c22f83b03a3
Headers:
Key | Value | Description |
---|---|---|
Content-Type | application/json | JSON type |
Body:
{
"name": "aman",
"email": "aman@aman.com"
}
Made with ♥ by vijayKumar | Generated at: 2021-03-26 00:39:34 by docgen