Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
WebBack
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
websystem
WebBack
Commits
bf61b46f
Commit
bf61b46f
authored
4 months ago
by
tpgus2603
Browse files
Options
Downloads
Patches
Plain Diff
refactor: db연결오류 및 로깅추가
parent
c4c903af
Branches
Branches containing commit
No related tags found
2 merge requests
!34
[#21] 배포 서버에서 로직 확인 위해 현재 코드 master에 merge
,
!33
[#21] 로그인 로직 수정 및 디비 연결 오류,로깅추가
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
app.js
+5
-4
5 additions, 4 deletions
app.js
models/Friend.js
+1
-1
1 addition, 1 deletion
models/Friend.js
models/Invite.js
+1
-1
1 addition, 1 deletion
models/Invite.js
schemas/ChatRooms.js
+1
-0
1 addition, 0 deletions
schemas/ChatRooms.js
sync.js
+0
-4
0 additions, 4 deletions
sync.js
with
8 additions
and
10 deletions
app.js
+
5
−
4
View file @
bf61b46f
...
...
@@ -9,9 +9,13 @@ const { initScheduleCleaner } = require('./utils/scheduler');
const
connectMongoDB
=
require
(
'
./config/mongoose
'
);
// MongoDB 연결
const
{
sequelize
}
=
require
(
'
./config/sequelize
'
);
// Sequelize 연결
const
cors
=
require
(
'
cors
'
);
const
morgan
=
require
(
'
morgan
'
);
const
syncRdb
=
require
(
'
./sync
'
);
// Import the syncDatabase function
const
app
=
express
();
app
.
use
(
morgan
(
'
dev
'
));
//로깅용
// CORS 설정
app
.
use
(
cors
({
...
...
@@ -72,14 +76,11 @@ const PORT = process.env.PORT || 3000;
try
{
// MongoDB 연결
await
connectMongoDB
();
//console.log('✅ MongoDB 연결 성공');
console
.
log
(
'
MongoDB URI:
'
,
process
.
env
.
MONGO_URI
);
// MySQL 연결 확인
await
syncRdb
();
// 서버 시작
app
.
listen
(
PORT
,
()
=>
{
console
.
log
(
`Server is running on
http://localhost:
${
PORT
}
`
);
console
.
log
(
`Server is running on
${
PORT
}
`
);
});
}
catch
(
error
)
{
console
.
error
(
'
❌ 서버 시작 중 오류 발생:
'
,
error
);
...
...
This diff is collapsed.
Click to expand it.
models/Friend.js
+
1
−
1
View file @
bf61b46f
//models/friend.js
//
models/friend.js
const
{
DataTypes
}
=
require
(
'
sequelize
'
);
const
sequelize
=
require
(
'
../config/sequelize
'
);
...
...
This diff is collapsed.
Click to expand it.
models/Invite.js
+
1
−
1
View file @
bf61b46f
//
models/invite.js
//models/invite.js
const
{
DataTypes
}
=
require
(
'
sequelize
'
);
const
sequelize
=
require
(
'
../config/sequelize
'
);
...
...
This diff is collapsed.
Click to expand it.
schemas/ChatRooms.js
+
1
−
0
View file @
bf61b46f
// schemas/chatRooms.js
const
mongoose
=
require
(
'
mongoose
'
);
// MongoDB 채팅방 스키마 수정 (FCM 토큰을 배열로 관리)
...
...
This diff is collapsed.
Click to expand it.
sync.js
+
0
−
4
View file @
bf61b46f
...
...
@@ -14,10 +14,6 @@ async function syncRdb() {
// 모든 모델 동기화
await
sequelize
.
sync
({
force
:
true
});
console
.
log
(
'
모든 모델이 성공적으로 동기화되었습니다.
'
);
// 연결 종료
await
sequelize
.
close
();
console
.
log
(
'
Rdb데이터베이스 연결이 종료되었습니다.
'
);
}
catch
(
error
)
{
console
.
error
(
'
Rdb데이터베이스 연결 실패:
'
,
error
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment