We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8201206 commit b8288a1Copy full SHA for b8288a1
README.md
@@ -1,2 +1,15 @@
1
# back-end
2
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
products/products-model.js
@@ -26,9 +26,12 @@ function find() {
26
}
27
28
function add(product) {
29
- const [id] = db("products").insert(product, "id");
30
-
31
- return findById(id);
+ return db("products")
+ .insert(product, "id")
+ .then(ids => {
32
+ const [id] = ids;
33
+ return findById(id);
34
+ });
35
36
37
function findById(id) {
0 commit comments