fix: update envision-cli tools for proxy and run app
This commit is contained in:
23
src/app.ts
23
src/app.ts
@@ -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');
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user