Skip to content

Commit

Permalink
make count.js more foolproof
Browse files Browse the repository at this point in the history
  • Loading branch information
NielsHoffmann committed Feb 12, 2025
1 parent 4095ede commit d8c9378
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
node_modules/
package-lock.json
Presentatie/
.vscode/settings.json
11 changes: 8 additions & 3 deletions data/processes/countFeatures/count.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
export default async function count(uri) {
const res = await fetch(uri);
const body = await res.json();
return body.numberMatched;
if (uri.endsWith("/items")){
const res = await fetch(uri);
const body = await res.json();
return body.numberMatched;
} else {
return "not a valid endpoint..."
}

}

0 comments on commit d8c9378

Please sign in to comment.