서주원

create new schema and add cards.json

......@@ -2,4 +2,12 @@
node_modules
¼ҽSW Ʈ.txt
\ No newline at end of file
*.txt
.env
*.log
npm-debug.log*
......
No preview for this file type
......@@ -7,6 +7,8 @@ const bcrypt=require('bcrypt-nodejs')
const rp=require('request-promise')
const morgan=require('morgan')
const cheerio=require('cheerio')
const mysql=require('mysql')
require('dotenv').config()
const app=express()
app.use(morgan('[:date[iso]] :method :status :url :response-time(ms) :user-agent'))
......@@ -21,6 +23,19 @@ app.use(function (req, res, next) {
next()
})
const connection=mysql.createConnection({
host:process.env.DB_HOST,
user:process.env.DB_USER,
password:process.env.DB_PASSWORD,
database:'user',
port:''
})
let allCards=[]
fs.readFile('cardskoKR.json',(err,data)=>{
allCards=JSON.parse(data)
})
app.use(session({
secret:'ambc@!vsmkv#!&*!#EDNAnsv#!$()_*#@',
resave:false,
......@@ -39,3 +54,7 @@ app.get('/main',(req,res)=>{
res.writeHead(200, {'Content-Type': 'text/html'})
}
})
app.listen(process.env.SERVER_PORT || 3000,()=>{
console.log('sample server is listening to port ' + process.env.SERVER_PORT)
})
\ No newline at end of file
......
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
......@@ -16,11 +16,14 @@
"bcrypt-nodejs": "0.0.3",
"body-parser": "^1.18.3",
"cheerio": "^1.0.0-rc.2",
"dotenv": "^6.1.0",
"express": "^4.16.4",
"express-session": "^1.15.6",
"fs": "0.0.1-security",
"morgan": "^1.9.1",
"mysql": "^2.16.0",
"path": "^0.12.7",
"request": "^2.88.0",
"request-promise": "^4.2.2"
}
}
......