import { app, showMore, showRes } from './common.ts'; import crypto from 'node:crypto'; export const getStringHash = (str: string) => { return crypto.createHash('md5').update(str).digest('hex'); } const code = `// 这是一个示例代码文件 import {App} from '@kevisual/router'; const app = new App(); app.route({ path: 'hello', description: 'LightCode 示例路由 2323232323', metadata: { tags: ['light-code', 'example'], }, }).define(async (ctx) => { console.log('tokenUser:', ctx.query?.tokenUser); ctx.body = 'Hello from LightCode!'; }).addTo(app); app.wait();` const code2 = `const a = 1` const res = await app.run({ path: 'light-code', key: 'update', payload: { data: { title: 'Demo Light Code', description: '这是一个演示用的轻代码项目,包含一个简单的路由示例。', type: 'light-code', tags: ['demo', 'light-code'], data: {}, code: code, hash: getStringHash(code), }, token: "st_idht7xpffhgu2eeh94zd8ze1t7ew3amy", }, }) console.log('showMore', showMore(res));