Skip to content

thecurious1-sudo/ReBuy-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ReBuy-frontend

This is the backend code for my clone of OLX type website-ReBuy.

Important Points

Run Locally

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

You will need Node.js and npm (which comes with Node) installed on your machine.

Installation

  1. Clone the repository:
  git clone https://github.com/thecurious1-sudo/ReBuy-backend
  1. Go to the project directory
  cd ReBuy-backend
  1. Install dependencies
  npm install
  1. Start the server
  node index.js

The app will open in your default browser at http://localhost:4000

Environment Variables

To run this project, you will need to add the following environment variables to your root level .env file

  • JWT_SECRET - used to generate JSON WebToken for encoding purpose
  • MONGODB_URL - mongoDB connection url( Use mongodb://0.0.0.0:27017/ReBuy if you are testing it locally or for online hosting, you can generate one from MongoDB Atlas platform)

Seeding Data

I've created some sample data to seed the database. You can seed your DB by:-

  cd seeds
  node index.js

API Reference

  • /user routes

  POST /user/login

Body

Field Type Description
email string Required. Email Id
password string Required. Password
  POST /user/signup

Body

Field Type Description
name string Required. Name
email string Required. Email Id
password string Required. Password
username string Username
DOB string Date of Birth
address string Address
phone string Phone Number
  • /products routes

  POST /products/

Body

Field Type Description
token string Required. Authorization Token
  POST /products/new

Body

Field Type Description
token string Required. Authorization Token
name string Required. Name of the product
description string Required. Description of the product
price string Required. Price of product
address string Required. Address of exchange
  POST /products/:id

Body

Field Type Description
token string Required. Authorization Token

Parameters

Field Type Description
id string Required. Product ID
  • /orders routes

  POST /orders/ - Get all the orders of logged in user

Body

Field Type Description
token string Required. Authorization Token
  POST /orders/new - Create a new order

Body

Field Type Description
token string Required. Authorization Token
productId string Required. Product ID
  POST /orders/:id

Body

Field Type Description
token string Required. Authorization Token

Parameters

Field Type Description
id string Required. Order ID
  • /myItems routes

  POST /myItems/ - Get all the items posted by the user

Body

Field Type Description
token string Required. Authorization Token
  POST /myItems/:id

Body

Field Type Description
token string Required. Authorization Token

Parameters

Field Type Description
id string Required. Item ID

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published