1 Star 0 Fork 1

路拾遗(个人)/game_doudizhu

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
app.ts 2.17 KB
Copy Edit Raw Blame History
路拾遗 authored 2021-09-11 09:25 . 开发中
import log4js from "common-log4js";
import { basename } from "path";
const logger = log4js.getLogger(basename(__filename));
///////////////////////////////////////////////////////
import config = require("./config.json");
import { server_report_async, IServerReq, server_manager_start_async, init_manage_server_config } from "common-manager"
import { server_start as http_server_start } from "./server/httpSvr";
import { server_start as ws_server_start } from "./server/wsSvr";
import { SERVER_NAME, SERVER_REMARK, DEPEND_SERVERS } from "./interface/servers";
import { ConnectionOptions, createConnection } from "typeorm";
import { createRedisClient } from "common-redis";
(async () => {
logger.info("==========================程序 启动 开始==========================");
const serverInfo: IServerReq = {
server_type: SERVER_NAME,
server_id: SERVER_NAME + "|" + (process.env.NODE_APP_INSTANCE ? process.env.NODE_APP_INSTANCE : "0"),
tick_time: 0,
http_ip: config.http_ip,
http_port: config.http_port,
ws_ip: config.ws_ip,
ws_port: config.ws_port,
load: 0,
memory: "",
remark: SERVER_REMARK,
};
const option: ConnectionOptions = {
type: "mysql",
entities: [
"src/entity/**/*.*s",
],
};
Object.assign(option, config.ormconfig);
await createConnection(option);
// 连接redis
createRedisClient(config.redisconfig);
// 开启http服务
http_server_start(config.http_ip, config.http_port);
// 开启ws服务
ws_server_start(config.ws_port);
// 注册服务
const manage_server = config.manage_server;
await server_report_async(serverInfo, manage_server.http_ip, manage_server.http_port, config.tick_time / 10);
// 管理依赖服务
init_manage_server_config(manage_server.http_ip, manage_server.http_port);
await server_manager_start_async([
DEPEND_SERVERS.HALL_SERVER,
], config.tick_time);
logger.info("==========================程序 启动 完毕==========================");
})()
process.on('uncaughtException', function (err) {
logger.fatal("uncaughtException=======================>\n", err);
});
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
TypeScript
1
https://gitee.com/iwof/game_doudizhu.git
git@gitee.com:iwof/game_doudizhu.git
iwof
game_doudizhu
game_doudizhu
master

Search