45 lines
899 B
TypeScript
45 lines
899 B
TypeScript
import { App } from '@kevisual/router';
|
|
import { Manager } from '../module/manager.ts';
|
|
import { loadFileAppInfo } from '../module/load-app.ts';
|
|
import path from 'path';
|
|
|
|
const app = new App();
|
|
|
|
app
|
|
.route({
|
|
path: 'test',
|
|
key: 'test',
|
|
})
|
|
.define(async (ctx) => {
|
|
ctx.body = 'test';
|
|
});
|
|
|
|
const manager = new Manager({ mainApp: app });
|
|
|
|
await manager.load();
|
|
|
|
const { mainEntry, app: appConfig } = await loadFileAppInfo('mark');
|
|
|
|
// const appInfo = {
|
|
// key: 'mark',
|
|
// type: 'system-app',
|
|
// entry: mainEntry,
|
|
// status: 'running',
|
|
// path: path.dirname(mainEntry),
|
|
// };
|
|
|
|
// await manager.add(appInfo);
|
|
|
|
const client = await loadFileAppInfo('micro-client');
|
|
const appInfoMicro = {
|
|
key: 'micro-client',
|
|
type: 'micro-app',
|
|
entry: client.mainEntry,
|
|
status: 'running',
|
|
path: path.dirname(client.mainEntry),
|
|
};
|
|
|
|
await manager.add(appInfoMicro);
|
|
|
|
app.listen(3005);
|