Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Create GME list endpoint
  • Loading branch information
regalijan committed Oct 19, 2023
1 parent ce9160a commit bef8f6f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions functions/api/gme/list.ts
@@ -0,0 +1,16 @@
export async function onRequestGet(context: RequestContext) {
const list = await context.env.DATA.list({ prefix: "gamemod_" });
const entries = [];

for (const key of list.keys)
entries.push({
metadata: key.metadata,
user: key.name.replace("gamemod_", ""),
});

return new Response(JSON.stringify(entries), {
headers: {
"content-type": "application/json",
},
});
}

0 comments on commit bef8f6f

Please sign in to comment.