copy files
This commit is contained in:
+45
-1
@@ -1,8 +1,17 @@
|
||||
import 'reflect-metadata';
|
||||
import { BasicQueryDTO } from './api/index.js';
|
||||
import { validate } from 'class-validator';
|
||||
import express, { Request, Response } from "express"
|
||||
import { AppDataSource } from "./data_source"
|
||||
import dotenv from "dotenv";
|
||||
import session from "express-session";
|
||||
import path from 'node:path';
|
||||
|
||||
export async function test(){
|
||||
dotenv.config({
|
||||
path: `.env.server.${process.env.NODE_ENV}`
|
||||
});
|
||||
|
||||
export async function test() {
|
||||
console.log("Hello World!");
|
||||
|
||||
const dto = new BasicQueryDTO();
|
||||
@@ -17,4 +26,39 @@ export async function test(){
|
||||
|
||||
await test();
|
||||
|
||||
|
||||
AppDataSource.initialize().then(async () => {
|
||||
|
||||
// create express app
|
||||
const app = express()
|
||||
app.use(bodyParser.json())
|
||||
app.use(session({
|
||||
secret: ownConfig.sessionSecret,
|
||||
resave: false,
|
||||
saveUninitialized: false,
|
||||
}))
|
||||
app.set('etag', false);
|
||||
|
||||
initPKIjs();
|
||||
|
||||
app.use('/', rootRouter);
|
||||
|
||||
await fs.mkdir(certDirPath, { recursive: true });
|
||||
if (!existsSync(rootSignKeyPath)) {
|
||||
console.info('generate sign key');
|
||||
generateRootSignKey();
|
||||
}
|
||||
|
||||
if (!existsSync(rootCertPath)) {
|
||||
console.info('generate root certificate');
|
||||
await generateRootCertificateEasy();
|
||||
}
|
||||
|
||||
// start express server
|
||||
app.listen(ownConfig.port)
|
||||
|
||||
console.log(`Express server has started on port ${ownConfig.port}`)
|
||||
|
||||
}).catch(error => console.log(error))
|
||||
|
||||
export default {};
|
||||
Reference in New Issue
Block a user