Skip to content

Commit b8288a1

Browse files
author
Neel Mazumdar
committed
fixed products
1 parent 8201206 commit b8288a1

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,15 @@
11
# back-end
22
Back End of African Marketplace III
3+
4+
Endpoints:
5+
6+
POST: api/auth/register
7+
POST: api/auth/login
8+
GET: api/users
9+
GET: api/users/id
10+
11+
GET: api/products
12+
GET: api/products/id
13+
POST: api/products
14+
PUT: api/products/id
15+
DELETE: api/products/id

data/auth.db3

0 Bytes
Binary file not shown.

products/products-model.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,12 @@ function find() {
2626
}
2727

2828
function add(product) {
29-
const [id] = db("products").insert(product, "id");
30-
31-
return findById(id);
29+
return db("products")
30+
.insert(product, "id")
31+
.then(ids => {
32+
const [id] = ids;
33+
return findById(id);
34+
});
3235
}
3336

3437
function findById(id) {

0 commit comments

Comments
 (0)