fix: update envision-cli tools for proxy and run app

This commit is contained in:
2024-12-05 02:26:47 +08:00
parent 2145fca826
commit da6211299b
15 changed files with 738 additions and 479 deletions

View File

@@ -2,30 +2,11 @@ import { App } from '@kevisual/router';
import fs from 'fs';
import { getConfig, getPidList, pidFilePath, checkFileExists } from './module/get-config.ts';
import { sequelize } from './module/sequelize.ts';
import { spawn } from 'child_process';
export { sequelize };
export const app = new App();
app
.route({
path: 'ping',
})
.define(async (ctx) => {
ctx.body = 'pong';
})
.addTo(app);
app
.route({
path: 'demo',
key: '01',
})
.define(async (ctx) => {
ctx.body = 'Hello, World!';
})
.addTo(app);
// 处理进程退出或中断信号,确保删除 pid 文件
const cleanUp = () => {
const pidList = getPidList();
@@ -63,5 +44,5 @@ export const createApp = async () => {
app.listen(21015, () => {
console.log('Server is running on port 21015', 'http://localhost:21015/api/router', 'server id', process.pid);
});
import('./route.ts');
// import('./route.ts');
};