Skip to content

Replate is a platform that lets a business create requests to give out extras/leftovers and have a volunteer come pick up the food and take it to a predetermined place of need.

License

Notifications You must be signed in to change notification settings

Easybuoy/replate

Repository files navigation

Build Status Coverage Status Maintainability Language grade: JavaScript License: MIT

backend

API Service for replate application 🚀.

Link to API: https://re-plate.herokuapp.com/

How to setup the project

  • Create an account on ElephantSQl
  • Create a database instance in ElephantSQL and copy the connection string (URL)
  • create a .env file at the root of the project, copy the content of .env.example into it.
  • Assign the URL above to the DB_URL in .env file
  • npm install or yarn install
  • npm migrate or yarn migrate
  • npm run dev or yarn dev

Built With

Testing Tools

Getting Started

Prerequisites

You need Nodejs Installed to be able to run this project on your machine.

Installing

  • Clone Repository
git clone https://github.com/re-plate/backend 


  • Change Directory To Backend
cd backend


  • Install Dependencies
npm install


  • Start Application
npm start


  • Run Test
npm test


  • Run Coverage Report
npm run coveralls

API Routes


DESCRIPTION HTTP METHOD ROUTES ACCESS
Register User POST /api/v1/auth/register PUBLIC
Login User POST /api/v1/auth/login PUBLIC
Create Request POST /api/v1/requests/ PRIVATE
Get All Requests GET /api/v1/requests/all PRIVATE
Get Request By Id GET /api/v1/requests/:id PRIVATE
Update Request PUT /api/v1/requests/:id PRIVATE
Delete Request DELETE /api/v1/requests/:id PRIVATE
Get Created Requests GET /api/v1/requests/ PRIVATE
Accept Request POST /api/v1/requests/:id/action PRIVATE
Search Business GET /api/v1/search/business?name=query PRIVATE
Search Request GET /api/v1/search/requests PRIVATE

Register Route

Access: Public Method: POST Route: /api/v1/auth/register Payload: { name: STRING (required), username: STRING (required), email: STRING (required), password: STRING (required), type: INTEGER (required), phone: STRING (optional) }

Login Route

Access: Public Method: POST Route: /api/v1/auth/login Payload: { username: STRING (required), password: STRING (required) }

Create Request Route

Access: Private Method: POST Route: /api/v1/requests headers: { Authorization: token } Payload: { name: STRING (required), food_type: STRING (required), pickup_date: STRING (required), pickup_time: STRING (required), comment: STRING (optional), instruction: STRING (optional), }

Get All Requests (Business)

Access: Private Method: GET Route: /api/v1/requests headers: { Authorization: token }

Get All Requests (Volunteer)

Access: Private Method: GET Route: /api/v1/requests/all headers: { Authorization: token }

Get Request By Id

Access: Private Method: GET Route: /api/v1/requests/:id headers: { Authorization: token }

Update Request Route

Access: Private Method: PUT Route: /api/v1/requests/:id headers: { Authorization: token } Payload: { name: STRING (required), food_type: STRING (required), pickup_date: STRING (required), pickup_time: STRING (required), comment: STRING (optional), instruction: STRING (optional), }

Delete Request By Id

Access: Private Method: DELETE Route: /api/v1/requests/:id headers: { Authorization: token }

Accept Request By Id (Volunteer)

Access: Private Method: POST Route: /api/v1/requests/:id/action headers: { Authorization: token } Payload: { status: INTEGER (required) }

Search Business (Volunteer)

Access: Private Method: GET Route: /api/v1/search/business?name=query headers: { Authorization: token }

About

Replate is a platform that lets a business create requests to give out extras/leftovers and have a volunteer come pick up the food and take it to a predetermined place of need.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published