34 lines
941 B
TypeScript
34 lines
941 B
TypeScript
|
import dayjs from "dayjs";
|
||
|
import "dayjs/locale/zh-tw";
|
||
|
import * as path from "path";
|
||
|
import { WsServer } from "tsrpc";
|
||
|
import { BaseEnumerator } from "./Engine/CatanEngine/CoroutineV2/Core/BaseEnumerator";
|
||
|
import "./Engine/CatanEngine/CSharp/String";
|
||
|
import "./Engine/Utils/CCExtensions/ArrayExtension";
|
||
|
import "./Engine/Utils/CCExtensions/NumberExtension";
|
||
|
import { serviceProto } from './shared/protocols/serviceProto';
|
||
|
|
||
|
BaseEnumerator.Init();
|
||
|
dayjs.locale("zh-tw")
|
||
|
|
||
|
// Create the Server
|
||
|
export const server = new WsServer(serviceProto, {
|
||
|
port: 3003,
|
||
|
// Remove this to use binary mode (remove from the client too)
|
||
|
json: true
|
||
|
});
|
||
|
|
||
|
// Initialize before server start
|
||
|
async function init() {
|
||
|
await server.autoImplementApi(path.resolve(__dirname, 'api'));
|
||
|
|
||
|
// TODO
|
||
|
// Prepare something... (e.g. connect the db)
|
||
|
};
|
||
|
|
||
|
// Entry function
|
||
|
async function main() {
|
||
|
await init();
|
||
|
await server.start();
|
||
|
}
|
||
|
main();
|