Giter VIP home page Giter VIP logo

pen-pusher / express-backend-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dipankar-js/express-backend-api

0.0 1.0 0.0 183 KB

Backend API for a Bootcamp site with role based authentication using JWT token and developed using Express , MongoDB and Postman. A proper documentation of the API is available in the demo URL

Home Page: https://bootcamper.netlify.com/

JavaScript 11.66% HTML 88.34%

express-backend-api's Introduction

BootCamper API

Backend API for a bootcamp company to manage bootcamps, courses, reviews, users and authentication

Run this API locally

  • Clone the repo
  • run cmd - npm install
  • Place your own mongo URI from mLab in config/config.env file
  • run cmd - npm run dev

Indices


Bootcamps

Bootcamps CRUD functionality

1. Get all Bootcamps

Fetch all bootcamps from Databases which includes pagination, filtering etc

Endpoint:

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

2. Get Single Bootcamps

Fetch single bootcamp from Database

Endpoint:

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

Headers:

Key Value Description
Content-Type application/json JSON Data

3. Create a Bootcamp

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/bootcamps

Headers:

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": "[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 a Bootcamp

Update a specific bootcamp by ID in the Database

Endpoint:

Method: PUT
Type: RAW
URL: {{URL}}/api/v1/bootcamps/5e5ac0537380631790dc58a4

Headers:

Key Value Description
Content-Type application/json JSON Data

Body:

{
	 "name": "Edu-Uncle Bootcamp"
}

5. Delete a Bootcamp

Delete a bootcamp permanantly from the database.

Endpoint:

Method: DELETE
Type: 
URL: {{URL}}/api/v1/bootcamps/5e90e8f05bddbb3bc075a455

6. Get all Bootcamps by distance

Get Bootcamps within a radius of specific zipcode

Endpoint:

Method: GET
Type: 
URL: {{URL}}/api/v1/bootcamps/radius/02118/10

Headers:

Key Value Description
Content-Type application/json JSON Data

7. Pagination

Get Bootcamp by Pagination

Endpoint:

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

Headers:

Key Value Description
Content-Type application/json JSON Data

Query params:

Key Value Description
limit 1
page 2

8. Photo upload

Upload a photo for a specific bootcamp

Endpoint:

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

Headers:

Key Value Description
Content-Type application/json JSON Data

Body:

{
	 "name": "Edu-Uncle Bootcamp"
}

Courses

Create , Read , Update and Delete Course

1. Get all Courses

Get all courses API

Endpoint:

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

Headers:

Key Value Description
Content-Type application/json JSON Data

2. Get Courses by Bootcamp

Get all the courses belongs to a particular bootcamp.

Endpoint:

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

Headers:

Key Value Description
Content-Type application/json JSON Data

3. Create a Course

Create a course in a particular bootcamp by providing the bootcamp ID

Endpoint:

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

Body:

{
		"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"
}

4. Update a Courses

Update a course by their ID

Endpoint:

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

Body:

{
	"title":"React Developer"
}

5. Delete a Courses

Remove a course by their ID

Endpoint:

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

Authentication

Routes for user Authentication

1. Register user

Route for registering a user

Endpoint:

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

Headers:

Key Value Description
Content-Type application/json JSON Data

Body:

{
	"name" : "John Doe",
	"email":"[email protected]",
	"password":"123456",
	"role":"user"
	
}

2. Login

Route for user Login using email & password.

Endpoint:

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

Headers:

Key Value Description
Content-Type application/json JSON Data

Body:

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

3. Get LoggedIn user

Get the details of a loggedIn user by sending the JWT token in header

Endpoint:

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

Headers:

Key Value Description
Content-Type application/json JSON Data

4. Forgot Password

Genrerate password token and send Email

Endpoint:

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

Body:

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

5. Reset Password

PUT request for reset password using reset-token

Endpoint:

Method: PUT
Type: RAW
URL: {{URL}}/api/v1/auth/resetpassword/9b787b3dfe09c93c4a4641869a585ad0e14621de

Headers:

Key Value Description
Content-Type application/json JSON Data

Body:

{
	"password":"235689"
}

6. Update User

update user route for a loggedIn user

Endpoint:

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

Headers:

Key Value Description
Content-Type application/json JSON Data

Body:

{
	"email":"[email protected]",
	"name":"Dipankar Barman"
}

7. Change Password

Change password route for frontEnd

Endpoint:

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

Headers:

Key Value Description
Content-Type application/json JSON Data

Body:

{
	"currentPassword":"235689",
	"newPassword":"123456"
}

8. Logout user

Clear token from cookie

Endpoint:

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

Users

CRUD operation for users,accessible only for ADMIN

1. Get Users

Get all the list of users saved in Database

Endpoint:

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

Headers:

Key Value Description
Content-Type application/json JSON Data

2. Get a single User

Get a single user by their ID

Endpoint:

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

3. Create a user

Create a user route

Endpoint:

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

Body:

{
	"name":"Aarushi Sharma",
	"email":"[email protected]",
	"password":"123456"
}

4. Update user

Update a user by their ID

Endpoint:

Method: PUT
Type: RAW
URL: {{URL}}/api/v1/users/5e908cb6f04d834cdcd86fc1

Body:

{
	"name":"Aarushi Sharma",
	"email":"[email protected]"
}

5. Delete User

Delete a user by their ID

Endpoint:

Method: DELETE
Type: RAW
URL: {{URL}}/api/v1/users/5e908cb6f04d834cdcd86fc1

Reviews

Manage reviews for bootcamps

1. Get reviews

Get all reviews route

Endpoint:

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

2. Get reviews by Bootcamp

Get all reviews of a particular bootcamp

Endpoint:

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

3. Get Single reviews

Get a single review by their ID and populate bootcamp name and description

Endpoint:

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

4. Add review

Add a review for a specific bootcamp by user or ADMIN

Endpoint:

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

Headers:

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"
}

5. Update review

Update a particular review by their ID

Endpoint:

Method: PUT
Type: RAW
URL: {{URL}}/api/v1/reviews/5e90dafc08121747f89df87a

Headers:

Key Value Description
Content-Type application/json JSON Data

Body:

{
	"title":"Updating the bootcamp"
}

6. Delete review

Delete a review route

Endpoint:

Method: DELETE
Type: 
URL: {{URL}}/api/v1/reviews/5e90dafc08121747f89df87a

Headers:

Key Value Description
Content-Type application/json JSON Data

Back to top

Made with โ™ฅ by thedevsaddam | Generated at: 2020-04-11 18:34:16 by docgen

express-backend-api's People

Contributors

dipankar-js avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.