const counts = new Map(); export default defineEventHandler((event) => { const { mode } = getQuery(event); if (mode !== "bare" && mode !== "payload") { throw createError({ statusCode: 400, statusMessage: "Unknown variant" }); } const id = (counts.get(mode) || 0) + 1; counts.set(mode, id); const observation = { mode, id }; console.log("VISIT " + JSON.stringify(observation)); return observation; });