Submit a new username and password. Both MUST be unique for each new registration.
Example (doesn't exist in seed data):
{
username: "New_User", (required, unique)
password: "12345678" (required, unique),
profileImg: "https://fake-profile-image.com" (optional, default to null)
}
Login and get a token back.
Example (doesn't exist in seed data):
{
username: "New_User", (required, unique)
password: "12345678" (required, unique)
}
and the response will be:
{
message: "New_User is now logged in"
token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRsYXVkYWhsMSIsImlhdCI6MTU3NDEyOD",
id: 31,
username: New_User
}
Returns an array with all the users, response ex:
{
id: 1,
username: "Sam",
profileImg: "https://fake-profile-image.com"
},
{
id: 2,
username: "Dorothy",
profileImg: "https://fake-profile-image.com"
},
{
id: 3,
username: "Roberta",
profileImg: "https://fake-profile-image.com"
}
Returns a single user object, response ex:
{
id: 1,
username: "Emma",
profileImg: "https://fake-profile-image.com"
}
Returns a single user object that includes an array of the user's market items, response ex:
{
id: 1,
username: "Sam",
items: [
{
name: "basket",
description: "great for carrying produce",
price: 4,
category: "home",
location: "Kampala",
itemImg: "https://fake-item-image.com"
},
{
name: "necklace",
description: "handmade, beautiful!",
price: 88,
category: "art",
location: "Dar es Salaam",
itemImg: "https://fake-item-image.com"
}
]
}
Update any user by id.
Request body ex:
{
username: "Wayne",
password: "exc311Ent!"
profileImg: "https://fake-profile-image.com",
user_id: 1 (required, must match an existing user's id)
}
Response will only return the count.
Deletes a specific user by id. Response will only return the count.
Returns an arry with all the items, response ex:
[
{
name: "basket",
description: "great for carrying produce",
price: 4,
category: "home",
location: "Kampala",
itemImg: "https://fake-item-image.com",
owner: "Emma"
},
{
name: "necklace",
description: "handmade, beautiful!",
price: 88,
category: "art",
location: "Dar es Salaam",
itemImg: "https://fake-item-image.com",
owner: "Emma"
},
{
name: "table",
description: "large for 6 people",
price: 12,
category: "home",
location: "Nairobi",
itemImg: "https://fake-item-image.com",
owner: "Dorothy"
}
]
Returns a single market item by id, response ex:
{
name: "basket",
description: "great for carrying produce",
price: 4,
category: "home",
location: "Kampala",
itemImg: "https://fake-item-image.com",
owner: "Emma"
}
Add a new market item, user_id is REQUIRED. Request body ex:
{
name: "orange", (required)
description: "juicy fruit", (optional, defaults to null)
price: 2, (optional, defaults null)
category: "food", (optional, default to null)
location: "Zanzibar", (optional, default to null)
itemImg: "https://fake-item-image.com", (optional, default to null)
user_id: 1 (required, must match an existing user's id)
}
Response will return the new item.
Update any market item value by id.
user_id is also REQUIRED. Request body ex:
{
name: "apple",
description: "crisp fruit",
price: 3,
category: "food",
location: "Nairobi",
itemImg: "https://fake-item-image.com",
user_id: 1 (required, must match an existing user's id)
}
Response will only return the count.
Deletes a specific item by id. Response will only return the count.