Something went wrong. Try again.
a Page to view some global statistics about Modrinth modrinth-statistics.tobinio.dev
Something went wrong. Try again.
742 B · 20 lines
TypeScript
at tailwind
1234567891011121314151617181920import {exportStats, StatExport} from "~/server/utils/api/stats";import {ProjectTypes} from "~/utils/project";
export default defineEventHandler(async (event): Promise<StatExport> => { let query = getQuery(event);
let mode = query.mode as string; let type = query.type as ProjectTypes; let exclusive = query.exclusive === "true";
//todo: switch if (query.stat == "versions") { return exportStats(mode, type, exclusive, value => value.versions) } else if (query.stat == "count") { return exportStats(mode, type, exclusive, value => value.count) } else { return exportStats(mode, type, exclusive, value => value.downloads) } })