Skip to content

Commit d8c9378

Browse files
committed
make count.js more foolproof
1 parent 4095ede commit d8c9378

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
node_modules/
44
package-lock.json
55
Presentatie/
6+
.vscode/settings.json

data/processes/countFeatures/count.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
export default async function count(uri) {
2-
const res = await fetch(uri);
3-
const body = await res.json();
4-
return body.numberMatched;
2+
if (uri.endsWith("/items")){
3+
const res = await fetch(uri);
4+
const body = await res.json();
5+
return body.numberMatched;
6+
} else {
7+
return "not a valid endpoint..."
8+
}
9+
510
}

0 commit comments

Comments
 (0)