Files
core_ng/server/index.ts
T
2023-08-05 16:03:31 +00:00

70 lines
1.7 KiB
TypeScript

import 'dotenv/config';
import 'reflect-metadata';
import { BasicQueryDTO } from './api/index.js';
import { validate } from 'class-validator';
import express, { type Request, type Response } from "express"
import { AppDataSource } from "./data_source.js"
import session from "express-session";
import path from 'node:path';
import { LiteHashDRBG } from './util/LiteHashDRBG.js';
import { simpleSerialize } from './util/simpleSerialize.js';
export async function test() {
console.log("Hello World!");
console.log(process.env.GAME_DB_HOST);
const dto = new BasicQueryDTO();
dto.command = 'None';
dto.generalID = 1.1;
const result = await validate(dto);
console.log(result);
//must be integer가 나타나야함
const rawRng = new LiteHashDRBG(simpleSerialize(
'haha',
'hoho'
));
const arr: Promise<Uint8Array>[] = [];
let j = 0;
for(let i = 0; i < 100; i += 1){
arr.push(rawRng.nextBits(32).then((v) => {
console.log(`${j}: ${i}`);
j += 1;
return v;
}));
}
await Promise.all(arr);
}
await test();
const ownConfig = {
sessionSecret: process.env.SESSION_SECRET,
port: Number(process.env.SERVER_PORT),
}
/*
AppDataSource.initialize().then(async () => {
// create express app
const app = express()
app.use(session({
secret: ownConfig.sessionSecret,
resave: false,
saveUninitialized: false,
}))
app.set('etag', false);
//app.use('/', rootRouter);
// start express server
app.listen(ownConfig.port)
console.log(`Express server has started on port ${ownConfig.port}`)
}).catch(error => console.log(error))
*/
export default {};