Create GME list endpoint
This commit is contained in:
16
functions/api/gme/list.ts
Normal file
16
functions/api/gme/list.ts
Normal file
@ -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",
|
||||
},
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user