A Social platform for sending Parcels in any location
Installing dependencies
npm install
Create Development DB
npm run db:create
Run All migration
npm run db:migrate
Starting development server
npm start
Run the tests
npm run test
JSON object is expected to returned by each API end point, and their structure is below:
##Parcels
GET /parcels
{
"msg": "all parcels",
"parcels": [
{
"id": 1,
"pickupLocation": "Kigali",
"destination": "Kigeme",
"weight": 5,
"quantity": 8,
"userId": 1,
"status": "in_transity",
"createdAt": "2018-11-09T15:44:41.918Z"
}
]
}
GET /parcels/<parcelId>
{
"msg": "parcel found",
"parcel": {
"id": 1,
"pickupLocation": "Kigali",
"destination": "Kigeme",
"weight": 5,
"quantity": 8,
"userId": 1,
"status": "canceled",
"createdAt": "2018-11-09T15:44:41.918Z"
}
}
GET /users/<userId>/parcels
NB:
Currently, to test this endpoint user 1 as userId
{
"msg": "user pracles",
"parcels": [
{
"id": 1,
"pickupLocation": "Kigali",
"destination": "Kigeme",
"weight": 5,
"quantity": 8,
"userId": 1,
"status": "canceled",
"createdAt": "2018-11-09T15:44:41.918Z"
}
]
}
PUT /parcels/<parcelId>/cancel
{
"msg": "Parcel order canceled",
"parcel": {
"id": 1,
"pickupLocation": "Kigali",
"destination": "Kigeme",
"weight": 5,
"quantity": 8,
"userId": 1,
"status": "canceled",
"createdAt": "2018-11-09T15:44:41.918Z"
}
}
POST /parcels
required params are: pickupLocation, destination, weight, quantity.
{
"msg": "Parcel created",
"parcel": {
"id": 1,
"pickupLocation": "Kigali",
"destination": "Kigeme",
"weight": 5,
"quantity": 8,
"userId": 1,
"status": "in_transity",
"createdAt": "2018-11-09T15:44:41.918Z"
}
}