Market Backend

CRUD functionality for marketplace app containing all routes and requests.

Authentication 8

Routes for user and publishers to register, login and reset password.

Description

Route for users to receive a reset password token with an expiry of 10 minutes. The route generates a password token and sends an email to the user.

Headers
KeyValueDescription
Content-Typeapplication/json

JSON Type

Body
{ "email": "brian@gmail.com", "password": "123456" }
Description

Get logged in user via bearer token.

Description

Route for user to login to their account

Headers
KeyValueDescription
Content-Typeapplication/json

JSON Type

Body
{ "email": "brian@gmail.com", "password": "123456" }
Description

Logout currently logged in user

Description

Register a new user/publisher and insert them into the database

Headers
KeyValueDescription
Content-Typeapplication/json

JSON Type

Body
{ "name": "Brian", "email": "brian@gmail.com", "password": "123456", "role": "publisher" }
Description

Route to reset user password using reset token

Headers
KeyValueDescription
Content-Typeapplication/json

JSON Type

Body
{ "password": "1234567" }
Description

Logged in user can update their current password. Send in body current password and new password

Headers
KeyValueDescription
Content-Typeapplication/json

JSON Type

Body
{ "currentPassword": "1234567", "newPassword": "123456" }
Description

Update the details of a registered user in the database

Headers
KeyValueDescription
Content-Typeapplication/json

JSON Type

Body
{ "email": "brian1@gmail.com", "role":"user" }

Products 7

Description

Route for new products to be posted to

Headers
KeyValueDescription
Content-Typeapplication/json

JSON Type

Body
{ "name": "test", "description": "Trek road bike avaiable for rent. 21 gears and just serviced", "phone": "(111) 111-1111", "email": "sjy@gmail.com", "address": "220 Pawtucket St, Lowell, MA 01854", "rentalCost": "10 per day", "deposit": 850 }
Description

Delect product using it’s unique I.D.

Description

Get all products available from all users from database

Description

Get all Products from databse that are within a certain radius of a given location to allow users search by area and distance.

Description

Get single product from database using its unique I.D.

Description

Route to allow users upload an image of their product and for that image to be stored in the database

Description

Update product information in the database via a PUT request

Headers
KeyValueDescription
Content-Typeapplication/json

JSON Type

Body
{ "deposit": 300 }

Reviews 6

Manage product and user reviews.

Description

Insert review for a specific product

Headers
KeyValueDescription
Content-Typeapplication/json

JSON Type

Body
{ "title": "nice product", "text": "very good quality", "rating": "8" }
Description

Delete review as the logged in user who created the review (or admin).

Headers
KeyValueDescription
Content-Typeapplication/json

JSON Type

Description

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

Description

Get a single review for a product using the reviews I.D.

Description

Update review as the logged in user who created the review (or admin).

Headers
KeyValueDescription
Content-Typeapplication/json

JSON Type

Body
{ "title": "had fun" }

Users 5

Create Read Update Delete functionality for users only available to admins.

Description

Add user to database while logged in as admin

Headers
KeyValueDescription
Content-Typeapplication/json

JSON Type

Body
{ "name": "Peter pan", "email": "peter@gmail.com", "password": "123456" }
Description

Delete user from database while logged in as admin

Description

Get all users while logged in as admin

Description

Get single user by id while logged in as admin

Description

Update user while logged in as admin

Headers
KeyValueDescription
Content-Typeapplication/json

JSON Type

Body
{ "name": "Peter Pirate", "email": "peter@gmail.com", "password": "123456" }