import { router } from '../modules/router.ts'; import { Route } from '@abearxiong/router'; const getList = new Route('test', 'getList'); getList.run = async (ctx) => { ctx.body = 'test'; return ctx; }; router.add(getList); const codeRun = `async function run(ctx) { ctx.body = 'test js'; return ctx; }`; const fn: any = new Function( 'ctx', ` ${codeRun} return run(ctx); `, ); const codeRunRoute = new Route('test', 'run'); codeRunRoute.run = fn; router.add(codeRunRoute);