Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/ShivaBhattacharjee/KeyZen
/ fetchUser
Function
fetchUser
public/code/javascript/01_fetch_api.js:1–7 ·
view source on GitHub ↗
(id)
Source
from the content-addressed store, hash-verified
1
async
function
fetchUser(id) {
2
const
res =
await
fetch(`/api/users/${id}`);
3
if
(!res.ok) {
4
throw
new
Error(`HTTP ${res.status}`);
5
}
6
return
await
res.json();
7
}
8
9
async
function
main() {
10
try {
Callers
1
main
Function · 0.70
Calls
no outgoing calls
Tested by
no test coverage detected