Skip to content

desert3agle/xharktank-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🦈 XharkTank

This is backend for the application XharkTank, provides endpoints to pitch ideas to investors and to make counter-offers to entrepreneurs.

  • Pitch your one in a million idea to the panel of sharks 💸
  • Invest in the next big thing 📈

Live Deployed here.

Tech

  • Node.js - evented I/O for the backend
  • Express - fast node.js network app framework
  • MongoDB - cross-platform document-oriented database program

Installation

XharkTank requires Node.js v14+ and MongoDB v4+ to run.

Install the dependencies and devDependencies.

cd harsh-vardhan320-ME_BUILDOUT_XHARKTANK/
npm install

Setup environments variables. (fill in .env template)

mv src/config/.env.template src/config/.env

Start the server

npm run start

API Documentation

GET /pitches

Response

returns json of all pitches in reverse chronological order.

[
   {
      "id":string,
      "entrepreneur":string,
      "pitchTitle":string,
      "pitchIdea":string,
      "askAmount":float,
      "equity":float,
      "offers":[
         {
            "id":string,
            "investor":string,
            "amount":float,
            "equity":float,
            "comment":string
         }
      ]
   }
]
Status Code Description
200 OK
500 INTERNAL SERVER ERROR

GET /pitches/<pitch_id>

Response

returns json of a pitch

{
      "id":string,
      "entrepreneur":string,
      "pitchTitle":string,
      "pitchIdea":string,
      "askAmount":float,
      "equity":float,
      "offers":[
         {
            "id":string,
            "investor":string,
            "amount":float,
            "equity":float,
            "comment":string
         }
      ]
   }
Status Code Description
200 OK
404 NOT FOUND
500 INTERNAL SERVER ERROR

POST /pitches

Request

request body

{
   "entrepreneur":string,
   "pitchTitle":string,
   "pitchIdea":string,
   "askAmount":float,
   "equity":float
}

Response

returns id of the saved document

{
  "id" : string
}
Status Code Description
201 CREATED
400 BAD REQUEST
500 INTERNAL SERVER ERROR

POST /pitches/<pitch_id>/makeOffer

Request

request body

{
   "investor":string,
   "amount":float,
   "equity":float,
   "comment":string
}

Response

returns id of the saved document

{
  "id" : string
}
Status Code Description
201 CREATED
400 BAD REQUEST
404 NOT FOUND
500 INTERNAL SERVER ERROR

Deployment

Heroku Deployment

heroku login -i
heroku git:remote -a <your-app-name>
git push heroku master

Set up environment variables

heroku config:set ENV_VAR=<value>

Authors