Toggle navigation
Toggle navigation
This project
Loading...
Sign in
최재은
/
밀당강의봇
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김예미
2019-06-03 17:14:01 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
de635751cfbbc85d5cbc856c9ba531cbbaf696d3
de635751
1 parent
bdaf8285
Connect Database
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
1 deletions
config/db-config.json
db.js
package.json
template.js
config/db-config.json
0 → 100644
View file @
de63575
{
"host"
:
"localhost"
,
"user"
:
"root"
,
"password"
:
null
,
"host"
:
3306
,
"database"
:
"facebookbot"
}
db.js
0 → 100644
View file @
de63575
const
mysql
=
require
(
'mysql'
);
const
db_config
=
require
(
'./config/db-config.json'
);
let
db
;
function
connectDB
()
{
if
(
!
db
)
{
db
=
mysql
.
createConnection
(
db_config
);
db
.
connect
(
function
(
err
)
{
if
(
!
err
)
{
console
.
log
(
'Database is connected'
);
}
else
{
console
.
log
(
'Error: '
,
err
);
}
});
}
return
db
;
}
module
.
exports
=
connectDB
();
package.json
View file @
de63575
...
...
@@ -11,8 +11,9 @@
"license"
:
"ISC"
,
"dependencies"
:
{
"body-parser"
:
"^1.19.0"
,
"express"
:
"
^
4.17.1"
,
"express"
:
"4.17.1"
,
"mongoose"
:
"^5.5.12"
,
"mysql"
:
"2.17.1"
,
"request"
:
"^2.88.0"
}
}
...
...
template.js
View file @
de63575
const
db
=
require
(
'./db.js'
);
let
greetingText
=
"안녕하세요! 컴공/소융 강의평가 봇이에요. 아래에 버튼 3개를 눌러주세요."
;
// 인사말
let
greetingTitle
=
[
"교수명으로 검색"
,
"강의명으로 검색"
,
"HELP"
];
...
...
Please
register
or
login
to post a comment