import { app, redis } from '@/app.ts'; app .route({ path: 'page-proxy-app', key: 'status', }) .define(async (ctx) => { // const { user, app } = ctx.query; if (!user || !app) { ctx.body = { code: 400, message: 'user and app are required', }; return; } const key = `user:app:status:${app}:${user}`; const status = await redis.get(key); if (!status) { ctx.throw(404, 'status not found'); } try { const parsedStatus = JSON.parse(status); ctx.body = parsedStatus; } catch (e) { ctx.throw(400, 'status is not a valid json'); } }) .addTo(app);