API Service for replate application 🚀.
Link to API: https://re-plate.herokuapp.com/
- 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
- 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
git clone https://github.com/re-plate/backend
cd backend
npm install
npm start
npm test
npm run coveralls
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 |
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)
}
Access: Public
Method: POST
Route: /api/v1/auth/login
Payload: {
username: STRING (required),
password: STRING (required)
}
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),
}
Access: Private
Method: GET
Route: /api/v1/requests
headers: {
Authorization: token
}
Access: Private
Method: GET
Route: /api/v1/requests/all
headers: {
Authorization: token
}
Access: Private
Method: GET
Route: /api/v1/requests/:id
headers: {
Authorization: token
}
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),
}
Access: Private
Method: DELETE
Route: /api/v1/requests/:id
headers: {
Authorization: token
}
Access: Private
Method: POST
Route: /api/v1/requests/:id/action
headers: {
Authorization: token
}
Payload: {
status: INTEGER (required)
}
Access: Private
Method: GET
Route: /api/v1/search/business?name=query
headers: {
Authorization: token
}