Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/sparcs-kaist/taxi-back into #…
Browse files Browse the repository at this point in the history
…273-안-읽은-메세지-확인
  • Loading branch information
chlehdwon committed Sep 11, 2023
2 parents 0d1a745 + c595b5b commit d658d93
Show file tree
Hide file tree
Showing 32 changed files with 1,427 additions and 195 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*.code-workspace
*.swp
/logs/*.log
.vscode

# AdminJS 관련 디렉토리
.adminjs
15 changes: 13 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// 모듈 require
const express = require("express");
const http = require("http");
const { port: httpPort } = require("./loadenv");
const { port: httpPort, eventMode } = require("./loadenv");
const logger = require("./src/modules/logger");
const { connectDatabase } = require("./src/modules/stores/mongo");
const { startSocketServer } = require("./src/modules/socket");

// Firebase Admin 초기설정
Expand All @@ -11,6 +12,9 @@ require("./src/modules/fcm").initializeApp();
// 익스프레스 서버 생성
const app = express();

// 데이터베이스 연결
connectDatabase();

// [Middleware] request body 파싱
app.use(express.urlencoded({ extended: false }));
app.use(express.json());
Expand Down Expand Up @@ -38,6 +42,10 @@ app.use(require("./src/middlewares/limitRate"));
// [Router] Swagger (API 문서)
app.use("/docs", require("./src/routes/docs"));

// 2023 추석 이벤트 전용 라우터입니다.
eventMode &&
app.use(`/events/${eventMode}`, require("./src/lottery").lotteryRouter);

// [Middleware] 모든 API 요청에 대하여 origin 검증
app.use(require("./src/middlewares/originValidator"));

Expand All @@ -61,5 +69,8 @@ const serverHttp = http
logger.info(`Express 서버가 ${httpPort}번 포트에서 시작됨.`)
);

// socket.io 서버 시작 및 app 인스턴스에 저장
// socket.io 서버 시작
app.set("io", startSocketServer(serverHttp));

// [Schedule] 스케줄러 시작
require("./src/schedules")(app);
1 change: 1 addition & 0 deletions loadenv.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ module.exports = {
slackWebhookUrl: {
report: process.env.SLACK_REPORT_WEBHOOK_URL || "", // optional
},
eventMode: undefined,
};
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"firebase-admin": "^11.4.1",
"jsonwebtoken": "^8.5.1",
"mongoose": "^6.11.3",
"node-cron": "3.0.2",
"node-mocks-http": "^1.12.1",
"querystring": "^0.2.1",
"redis": "^4.2.0",
Expand Down
Loading

0 comments on commit d658d93

Please sign in to comment.