Toggle navigation
Toggle navigation
This project
Loading...
Sign in
김대휘
/
Do-gether
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김대휘
2020-07-03 13:32:38 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a1fe7a4e99ceaf71e5ad2fed88012e60c4915c6c
a1fe7a4e
1 parent
3fbd7823
DB 연결오류 재수정
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
19 deletions
server.js
server.js
View file @
a1fe7a4
...
...
@@ -21,25 +21,25 @@ const connection = mysql.createConnection({
database
:
conf
.
database
,
});
// connection.connect();
function
handleDisconnect
()
{
connection
.
connect
(
function
(
err
)
{
if
(
err
)
{
console
.
log
(
"error when connecting to db:"
,
err
);
setTimeout
(
handleDisconnect
,
4000
);
}
});
connection
.
on
(
"error"
,
function
(
err
)
{
console
.
log
(
"db error"
,
err
);
if
(
err
.
code
===
"PROTOCOL_CONNECTION_LOST"
)
{
return
handleDisconnect
();
}
else
{
throw
err
;
}
});
}
handleDisconnect
();
//
function handleDisconnect() {
//
connection.connect(function (err) {
//
if (err) {
//
console.log("error when connecting to db:", err);
//
setTimeout(handleDisconnect, 4000);
//
}
//
});
//
connection.on("error", function (err) {
//
console.log("db error", err);
//
if (err.code === "PROTOCOL_CONNECTION_LOST") {
//
return handleDisconnect();
//
} else {
//
throw err;
//
}
//
});
//
}
//
handleDisconnect();
app
.
use
(
bodyParser
.
json
());
app
.
use
(
bodyParser
.
urlencoded
({
extended
:
true
}));
...
...
Please
register
or
login
to post a comment