Toggle navigation
Toggle navigation
This project
Loading...
Sign in
설승환
/
tp_maple_website
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-06-25 03:24:12 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0c29c069269a40c6080f272d8dba4e5c0774ed96
0c29c069
1 parent
dd3904d3
mysql과 연결
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
1 deletions
app.js
app.js
View file @
0c29c06
...
...
@@ -6,13 +6,31 @@ const bodyParser = require('body-parser');
const
axios
=
require
(
'axios'
);
const
cheerio
=
require
(
'cheerio'
);
const
url
=
require
(
'url'
);
const
mysql
=
require
(
'mysql'
);
const
router
=
express
.
Router
();
const
connection
=
mysql
.
createConnection
({
host
:
'localhost'
,
user
:
'root'
,
password
:
'None'
,
database
:
'maple'
});
const
app
=
express
();
connection
.
connect
(
function
(
err
){
if
(
!
err
)
{
console
.
log
(
"Database is connected"
);
}
else
{
console
.
log
(
"connecting error"
);
}
})
const
server
=
http
.
createServer
(
app
);
app
.
set
(
'views'
,
__dirname
+
'/views'
);
app
.
set
(
'view engine'
,
'ejs'
);
app
.
use
(
'/css'
,
express
.
static
(
'./css'
));
app
.
use
(
'/img'
,
express
.
static
(
'./img'
));
app
.
use
(
express
.
static
(
path
.
join
(
__dirname
,
'Python Scripts'
)));
...
...
@@ -41,4 +59,8 @@ app.use(function(req,res,next){
server
.
listen
(
3000
,
function
(){
console
.
log
(
'server on'
);
});
\ No newline at end of file
});
...
...
Please
register
or
login
to post a comment