MCPcopy Create free account
hub / github.com/6174/comflowyspace / startAppServer

Function startAppServer

apps/node/src/app.ts:26–103  ·  view source on GitHub ↗
(params: {
  port:number,
  staticFolder?: string | null
})

Source from the content-addressed store, hash-verified

24});
25
26export async function startAppServer(params: {
27 port:number,
28 staticFolder?: string | null
29}) {
30 const {port = 3333, staticFolder} = params;
31 const app = express();
32
33 app.use(express.static(staticFolder ? staticFolder : 'public'));
34 app.use(express.json({
35 limit: '50mb'
36 }));
37
38 app.use(cors({
39 origin: '*',
40 methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
41 credentials: true,
42 }));
43
44 setupComfyUIProxy(app);
45
46
47 app.use('/static', (req, res, next) => {
48 const comfyDir = getComfyUIDir(); // 获取用户设置
49 if (comfyDir) {
50 express.static(comfyDir)(req, res, next); // 使用 express.static 服务
51 }
52 });
53
54
55 app.get('/', (req: Request, res: Response) => {
56 res.send('Hello, Express + TypeScript!');
57 });
58
59 app.get('/api/env_check', ApiEnvCheck);
60 app.get('/api/extension_infos', ApiRouteGetExtensions)
61 app.get('/api/frontend_extension', ApiRouteGetFrontendExtensions);
62 app.get('/api/model_infos', ApiRouteGetModels);
63
64 app.post('/api/add_bootstrap_task', ApiBootstrap);
65 app.post('/api/install_extension', ApiRouteInstallExtension)
66 app.post('/api/enable_extensions', ApiRouteEnableExtensions)
67 app.post('/api/disable_extensions', ApiRouteDisableExtensions)
68 app.post('/api/remove_extensions', ApiRouteRemoveExtensions)
69 app.post('/api/update_extensions', ApiRouteUpdateExtensions)
70 app.post('/api/install_pip_packages', ApiInstallPipPackages)
71
72 app.post('/api/install_model', ApiRouteInstallModel)
73 app.post('/api/add_task', ApiRouteAddTask);
74 app.post('/api/setup_config', ApiSetupConfig);
75 app.get('/api/all_configs', ApiGetAllConfig);
76 app.post('/api/update_sdwebui', ApiUpdateStableDiffusionConfig);
77 app.post('/api/update_run_config', ApiSetRunConfig);
78 app.post('/api/update_app_config', ApiSetAppConfig);
79 app.post('/api/bootstrap', ApiBootstrap);
80 app.post('/api/restart_comfy', ApiRestartComfyUI);
81 app.post('/api/update_comfy', ApiUpdateComfyUIAndRestart)
82 app.get('/api/get_conda_env_info', ApiGetCondaInfo);
83 app.get('/api/object_info', ApiGetObjectInfo)

Callers 1

index.tsFile · 0.90

Calls 8

setupComfyUIProxyFunction · 0.90
getComfyUIDirFunction · 0.90
setupWebsocketHandlerFunction · 0.90
downloadDefaultModelFunction · 0.90
serveMethod · 0.80
listenMethod · 0.80
logMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected