init demo

This commit is contained in:
2025-04-04 23:17:03 +08:00
parent c2877c3d3b
commit a225bd4f16
39 changed files with 1426 additions and 102 deletions

View File

@@ -0,0 +1,7 @@
import fs from 'fs';
import path from 'path';
export const getChatConfig = () => {
const config = fs.readFileSync(path.resolve(process.cwd(), 'config.json'), 'utf-8');
return JSON.parse(config);
};

21
src/modules/config.ts Normal file
View File

@@ -0,0 +1,21 @@
import { useConfig } from '@kevisual/use-config/env';
export const envConfig = useConfig() as any;
type ConfigType = {
/**
* 主机 http://localhost:3000
*/
host: string;
/**
* 路径 /api
*/
path: string;
/**
* 端口
*/
port: number;
};
export const config: ConfigType = {
host: envConfig.API_HOST || 'http://localhost:4005',
path: envConfig.API_PATH || '/api/router',
port: envConfig.PORT || 6666,
};

3
src/modules/db.ts Normal file
View File

@@ -0,0 +1,3 @@
import { useContextKey } from '@kevisual/use-config/context';
export const redis = useContextKey('redis');

View File

@@ -1,9 +0,0 @@
import { Mark, markModelInit } from '@kevisual/mark';
export { Mark, markModelInit };
export const init = () => {
markModelInit({
tableName: '',
});
};

View File

@@ -1 +0,0 @@
export { sequelize, redis } from '@kevisual/code-center-module';

View File

@@ -1,6 +1,5 @@
import { sequelize, User, UserInit, Org, OrgInit } from '@kevisual/code-center-module';
export { sequelize, User, UserInit, Org, OrgInit };
import { User, UserInit, Org, OrgInit } from '@kevisual/code-center-module/models';
export { User, Org };
export const init = () => {
UserInit();