Toggle navigation
Toggle navigation
This project
Loading...
Sign in
오지민
/
HomePurchaseAgePrediction
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
Ojimin
2021-06-09 21:54:12 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c34e7ea39194c9567ba5a60e637afdb9b793afca
c34e7ea3
1 parent
113a7ac6
Remove api.js
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
14 deletions
.gitignore
api.js
config/mysql.js
server.js
.gitignore
View file @
c34e7ea
...
...
@@ -2,3 +2,5 @@ node_modules/
package-lock.json
#dotenv environment variables file
.env
\ No newline at end of file
...
...
api.js
deleted
100644 → 0
View file @
113a7ac
const
express
=
require
(
'express'
);
const
mysql
=
require
(
'mysql'
);
const
app
=
express
();
const
dotenv
=
require
(
'dotenv'
).
config
();
//dotenv를 사용하기 위해서 dotenv 라이브러리를 불러온 뒤, config() 메소드를 호출
const
mysqlConObj
=
require
(
'./config/mysql'
);
//config의 mysql파일을 가져와 mysqlConnection 객체 사용
const
db
=
mysqlConObj
.
init
();
mysqlConObj
.
open
(
db
);
//db 연결
config/mysql.js
View file @
c34e7ea
...
...
@@ -14,8 +14,6 @@ const mysqlConnection = {
con
.
connect
(
err
=>
{
if
(
err
){
console
.
log
(
"MySQL 연결 실패 : "
,
err
);
}
else
{
console
.
log
(
"MySQL 연결 성공"
);
}
});
},
...
...
server.js
View file @
c34e7ea
...
...
@@ -2,14 +2,28 @@ const express = require("express");
const
fs
=
require
(
"fs"
);
const
path
=
require
(
"path"
);
const
HTTPS
=
require
(
"https"
);
const
mysql
=
require
(
'mysql'
);
const
app
=
express
();
const
domain
=
"2020105635.oss2021.tk"
;
const
sslport
=
8080
;
const
dotenv
=
require
(
'dotenv'
).
config
();
//dotenv를 사용하기 위해서 dotenv 라이브러리를 불러온 뒤, config() 메소드를 호출
const
mysqlConObj
=
require
(
'./config/mysql'
);
//config의 mysql파일을 가져와 mysqlConnection 객체 사용
const
db
=
mysqlConObj
.
init
();
app
.
use
(
express
.
static
(
path
.
join
(
__dirname
,
"kakao"
)));
app
.
use
(
express
.
static
(
path
.
join
(
__dirname
,
"public"
)));
mysqlConObj
.
open
(
db
);
//db 연결
db
.
query
(
'SELECT * FROM csvdata.csvdata'
,
function
(
error
,
results
,
fields
)
{
if
(
error
)
{
throw
(
error
);
}
console
.
log
(
results
[
0
].
amount
);
});
app
.
get
(
"/"
,
function
(
req
,
res
)
{
res
.
sendFile
(
path
.
join
(
__dirname
+
"/main.html"
));
});
...
...
Please
register
or
login
to post a comment