Backend API for a bootcamp company to manage bootcamps, courses, reviews, users and authentication
- Clone the repo
- run cmd - npm install
- Place your own mongo URI from mLab in config/config.env file
- run cmd - npm run dev
Bootcamps CRUD functionality
Fetch all bootcamps from Databases which includes pagination, filtering etc
Endpoint:
Method: GET
Type:
URL: {{URL}}/api/v1/bootcamps/Fetch single bootcamp from Database
Endpoint:
Method: GET
Type:
URL: {{URL}}/api/v1/bootcamps/5e90e8f05bddbb3bc075a455Headers:
| Key | Value | Description |
|---|---|---|
| Content-Type | application/json | JSON Data |
Add a bootcamp in the Database. User must be authenticated and have publisher or admin access.
Endpoint:
Method: POST
Type: RAW
URL: {{URL}}/api/v1/bootcampsHeaders:
| Key | Value | Description |
|---|---|---|
| Content-Type | application/json | JSON Data |
Body:
{ "name": "React Bootcamp",
"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": "enroll@devworks.com",
"address": "233 Bay State Rd Boston MA 02215",
"careers": ["Web Development", "UI/UX", "Business"],
"housing": true,
"jobAssistance": true,
"jobGuarantee": false,
"acceptGi": true
}Update a specific bootcamp by ID in the Database
Endpoint:
Method: PUT
Type: RAW
URL: {{URL}}/api/v1/bootcamps/5e5ac0537380631790dc58a4Headers:
| Key | Value | Description |
|---|---|---|
| Content-Type | application/json | JSON Data |
Body:
{
"name": "Edu-Uncle Bootcamp"
}Delete a bootcamp permanantly from the database.
Endpoint:
Method: DELETE
Type:
URL: {{URL}}/api/v1/bootcamps/5e90e8f05bddbb3bc075a455Get Bootcamps within a radius of specific zipcode
Endpoint:
Method: GET
Type:
URL: {{URL}}/api/v1/bootcamps/radius/02118/10Headers:
| Key | Value | Description |
|---|---|---|
| Content-Type | application/json | JSON Data |
Get Bootcamp by Pagination
Endpoint:
Method: GET
Type:
URL: {{URL}}/api/v1/bootcampsHeaders:
| Key | Value | Description |
|---|---|---|
| Content-Type | application/json | JSON Data |
Query params:
| Key | Value | Description |
|---|---|---|
| limit | 1 | |
| page | 2 |
Upload a photo for a specific bootcamp
Endpoint:
Method: PUT
Type: RAW
URL: {{URL}}/api/v1/bootcamps/5d725a1b7b292f5f8ceff788/photoHeaders:
| Key | Value | Description |
|---|---|---|
| Content-Type | application/json | JSON Data |
Body:
{
"name": "Edu-Uncle Bootcamp"
}Create , Read , Update and Delete Course
Get all courses API
Endpoint:
Method: GET
Type:
URL: {{URL}}/api/v1/coursesHeaders:
| Key | Value | Description |
|---|---|---|
| Content-Type | application/json | JSON Data |
Get all the courses belongs to a particular bootcamp.
Endpoint:
Method: GET
Type:
URL: {{URL}}/api/v1/bootcamps/5d725a1b7b292f5f8ceff788/coursesHeaders:
| Key | Value | Description |
|---|---|---|
| Content-Type | application/json | JSON Data |
Create a course in a particular bootcamp by providing the bootcamp ID
Endpoint:
Method: POST
Type: RAW
URL: {{URL}}/api/v1/bootcamps/5d713a66ec8f2b88b8f830b8/coursesBody:
{
"title": "React 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": 12000,
"minimumSkill": "intermediate",
"scholarhipsAvailable": true,
"user": "5d7a514b5d2c12c7449be045"
}Update a course by their ID
Endpoint:
Method: PUT
Type: RAW
URL: {{URL}}/api/v1/courses/5d725a4a7b292f5f8ceff789Body:
{
"title":"React Developer"
}Remove a course by their ID
Endpoint:
Method: DELETE
Type:
URL: {{URL}}/api/v1/courses/5d725a4a7b292f5f8ceff789Routes for user Authentication
Route for registering a user
Endpoint:
Method: POST
Type: RAW
URL: {{URL}}/api/v1/auth/registerHeaders:
| Key | Value | Description |
|---|---|---|
| Content-Type | application/json | JSON Data |
Body:
{
"name" : "John Doe",
"email":"john@gmail.com",
"password":"123456",
"role":"user"
}Route for user Login using email & password.
Endpoint:
Method: POST
Type: RAW
URL: {{URL}}/api/v1/auth/loginHeaders:
| Key | Value | Description |
|---|---|---|
| Content-Type | application/json | JSON Data |
Body:
{
"email":"publisher@gmail.com",
"password":"123456"
}Get the details of a loggedIn user by sending the JWT token in header
Endpoint:
Method: GET
Type: RAW
URL: {{URL}}/api/v1/auth/meHeaders:
| Key | Value | Description |
|---|---|---|
| Content-Type | application/json | JSON Data |
Genrerate password token and send Email
Endpoint:
Method: POST
Type: RAW
URL: {{URL}}/api/v1/auth/forgotpasswordBody:
{
"email":"barman498@gmail.com"
}PUT request for reset password using reset-token
Endpoint:
Method: PUT
Type: RAW
URL: {{URL}}/api/v1/auth/resetpassword/9b787b3dfe09c93c4a4641869a585ad0e14621deHeaders:
| Key | Value | Description |
|---|---|---|
| Content-Type | application/json | JSON Data |
Body:
{
"password":"235689"
}update user route for a loggedIn user
Endpoint:
Method: PUT
Type: RAW
URL: {{URL}}/api/v1/auth/updatedetailsHeaders:
| Key | Value | Description |
|---|---|---|
| Content-Type | application/json | JSON Data |
Body:
{
"email":"barman498@gmail.com",
"name":"Dipankar Barman"
}Change password route for frontEnd
Endpoint:
Method: PUT
Type: RAW
URL: {{URL}}/api/v1/auth/updatepasswordHeaders:
| Key | Value | Description |
|---|---|---|
| Content-Type | application/json | JSON Data |
Body:
{
"currentPassword":"235689",
"newPassword":"123456"
}Clear token from cookie
Endpoint:
Method: GET
Type:
URL: {{URL}}/api/v1/auth/logoutCRUD operation for users,accessible only for ADMIN
Get all the list of users saved in Database
Endpoint:
Method: GET
Type:
URL: {{URL}}/api/v1/usersHeaders:
| Key | Value | Description |
|---|---|---|
| Content-Type | application/json | JSON Data |
Get a single user by their ID
Endpoint:
Method: GET
Type:
URL: {{URL}}/api/v1/users/5c8a1d5b0190b214360dc038Create a user route
Endpoint:
Method: POST
Type: RAW
URL: {{URL}}/api/v1/usersBody:
{
"name":"Aarushi Sharma",
"email":"aarushi@gmail.com",
"password":"123456"
}Update a user by their ID
Endpoint:
Method: PUT
Type: RAW
URL: {{URL}}/api/v1/users/5e908cb6f04d834cdcd86fc1Body:
{
"name":"Aarushi Sharma",
"email":"aarushikSUDIM@gmail.com"
}Delete a user by their ID
Endpoint:
Method: DELETE
Type: RAW
URL: {{URL}}/api/v1/users/5e908cb6f04d834cdcd86fc1Manage reviews for bootcamps
Get all reviews route
Endpoint:
Method: GET
Type:
URL: {{URL}}/api/v1/reviewsGet all reviews of a particular bootcamp
Endpoint:
Method: GET
Type:
URL: {{URL}}/api/v1/bootcamps/5d713a66ec8f2b88b8f830b8/reviewsGet a single review by their ID and populate bootcamp name and description
Endpoint:
Method: GET
Type:
URL: {{URL}}/api/v1/reviews/5d7a514b5d2c12c7449be024Add a review for a specific bootcamp by user or ADMIN
Endpoint:
Method: POST
Type: RAW
URL: {{URL}}/api/v1/bootcamps/5e90dab508121747f89df878/reviewsHeaders:
| Key | Value | Description |
|---|---|---|
| Content-Type | application/json | JSON Data |
Body:
{
"title": "Testing another review!",
"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": "5"
}Update a particular review by their ID
Endpoint:
Method: PUT
Type: RAW
URL: {{URL}}/api/v1/reviews/5e90dafc08121747f89df87aHeaders:
| Key | Value | Description |
|---|---|---|
| Content-Type | application/json | JSON Data |
Body:
{
"title":"Updating the bootcamp"
}Delete a review route
Endpoint:
Method: DELETE
Type:
URL: {{URL}}/api/v1/reviews/5e90dafc08121747f89df87aHeaders:
| Key | Value | Description |
|---|---|---|
| Content-Type | application/json | JSON Data |
Made with ♥ by thedevsaddam | Generated at: 2020-04-11 18:34:16 by docgen