Add embedded Express admin API and unified dev workflow.
Move admin backend into this repo (Express + MySQL on :8085) so npm run dev starts both API and Vite, with updated env defaults and Caddy config for gadm.tkmind.cn. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { loadProjectEnv } from './load-env.mjs';
|
||||
import { bootstrapAdminServices } from './bootstrap.mjs';
|
||||
import { importMemind } from './lib-path.mjs';
|
||||
import { createAdminApp } from './app.mjs';
|
||||
|
||||
loadProjectEnv();
|
||||
|
||||
const port = Number(process.env.ADM_API_PORT ?? 8085);
|
||||
|
||||
const ready = bootstrapAdminServices();
|
||||
const services = {
|
||||
ready,
|
||||
importUserAuthModule: () => importMemind('user-auth.mjs'),
|
||||
importAuthModule: () => importMemind('auth.mjs'),
|
||||
};
|
||||
|
||||
ready
|
||||
.then(({ pool, userAuth, llmProviderService }) => {
|
||||
Object.assign(services, { pool, userAuth, llmProviderService });
|
||||
const app = createAdminApp(services);
|
||||
app.listen(port, '127.0.0.1', () => {
|
||||
console.log(`TKMind Admin API @ http://127.0.0.1:${port}`);
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error('Admin server bootstrap failed:', err);
|
||||
process.exit(1);
|
||||
});
|
||||
Reference in New Issue
Block a user