파일 위치 이동

This commit is contained in:
2023-09-23 14:21:21 +00:00
parent 438df6cd3c
commit 4e629e0b1e
42 changed files with 206 additions and 781 deletions
+5
View File
@@ -0,0 +1,5 @@
import type { structure } from "@sammo/api_def";
import type { APINamespaceType } from "@strpc/express";
export const sammoAPI = {
} satisfies APINamespaceType<typeof structure>;
+8 -10
View File
@@ -1,21 +1,19 @@
import './dotenv.js'
import 'reflect-metadata';
import connectDB from './connectDB.js';
import express, { type Request, type Response } from "express"
import session from "express-session";
import path from 'node:path';
import { LiteHashDRBG } from './util/LiteHashDRBG.js';
import { simpleSerialize } from './util/simpleSerialize.js';
import { buildAPISystem } from './api/generator.js';
import { unwrap } from './util/unwrap.js';
import { sammoAPI } from './api/api.js';
import { ownConfig } from './serverConfig.js';
import { buildAPISystem } from '@strpc/express/generator';
import { sammoAPI } from './api/index.js';
import { unwrap } from '@sammo/util';;
import { serverConfig } from './serverConfig.js';
connectDB.then(async (db) => {
// create express app
const app = express()
app.use(express.json());
app.use(session({
secret: unwrap(ownConfig.sessionSecret),
secret: unwrap(serverConfig.sessionSecret),
resave: false,
saveUninitialized: false,
}))
@@ -24,9 +22,9 @@ connectDB.then(async (db) => {
app.use('/api', buildAPISystem(sammoAPI));
// start express server
app.listen(ownConfig.port)
app.listen(serverConfig.port)
console.log(`Express server has started on port ${ownConfig.port}`)
console.log(`Express server has started on port ${serverConfig.port}`)
}).catch(error => console.log(error));
+2 -2
View File
@@ -1,7 +1,7 @@
import 'dotenv/config';
import { unwrap } from './util/unwrap.js';
import { unwrap } from '@sammo/util';
export const ownConfig = {
export const serverConfig = {
sessionSecret: unwrap(process.env.SESSION_SECRET),
port: Number(unwrap(process.env.SERVER_PORT)),
gatewayHost: unwrap(process.env.GATEWAY_HOST),