Skip to content

Commit 922385e

Browse files
committed
Change: improve the get book API
1 parent 107bc78 commit 922385e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ app.get("/api/books/:id", (req, res) => {
3434
const rawData = fs.readFileSync("books.json");
3535
const books = JSON.parse(rawData);
3636
var arrayFound = books.filter(function (item) {
37-
return item.id == req.params.id;
37+
return item.id === req.params.id;
3838
});
39-
res.status(200).json(arrayFound[0]);
39+
res.status(200).json(arrayFound);
4040
});
4141

4242
app.get("/api/users/login", (req, res) => {

0 commit comments

Comments
 (0)