Toggle navigation
Toggle navigation
This project
Loading...
Sign in
육현진
/
DBproject
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
육현진
2020-12-08 07:22:59 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
36b0af93c7bd4eb4d28be3b63bdc82de2b908f64
36b0af93
1 parent
2698b8af
create db table & node.js db connection
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
89 additions
and
25 deletions
.gitignore
client/.eslintcache
package-lock.json
package.json
server.js
.gitignore
View file @
36b0af9
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
#database
/database.json
# dependencies
/node_modules
/.pnp
...
...
client/.eslintcache
View file @
36b0af9
This diff is collapsed. Click to expand it.
package-lock.json
View file @
36b0af9
...
...
@@ -46,6 +46,11 @@
"resolved"
:
"https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz"
,
"integrity"
:
"sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
},
"bignumber.js"
:
{
"version"
:
"9.0.0"
,
"resolved"
:
"https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz"
,
"integrity"
:
"sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A=="
},
"body-parser"
:
{
"version"
:
"1.19.0"
,
"resolved"
:
"https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz"
,
...
...
@@ -170,6 +175,11 @@
"resolved"
:
"https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz"
,
"integrity"
:
"sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
},
"core-util-is"
:
{
"version"
:
"1.0.2"
,
"resolved"
:
"https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz"
,
"integrity"
:
"sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
},
"date-fns"
:
{
"version"
:
"2.16.1"
,
"resolved"
:
"https://registry.npmjs.org/date-fns/-/date-fns-2.16.1.tgz"
,
...
...
@@ -453,6 +463,11 @@
"resolved"
:
"https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz"
,
"integrity"
:
"sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng=="
},
"isarray"
:
{
"version"
:
"1.0.0"
,
"resolved"
:
"https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz"
,
"integrity"
:
"sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
},
"json-parse-better-errors"
:
{
"version"
:
"1.0.2"
,
"resolved"
:
"https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz"
,
...
...
@@ -521,6 +536,17 @@
"resolved"
:
"https://registry.npmjs.org/ms/-/ms-2.0.0.tgz"
,
"integrity"
:
"sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
},
"mysql"
:
{
"version"
:
"2.18.1"
,
"resolved"
:
"https://registry.npmjs.org/mysql/-/mysql-2.18.1.tgz"
,
"integrity"
:
"sha512-Bca+gk2YWmqp2Uf6k5NFEurwY/0td0cpebAucFpY/3jhrwrVGuxU2uQFCHjU19SJfje0yQvi+rVWdq78hR5lig=="
,
"requires"
:
{
"bignumber.js"
:
"9.0.0"
,
"readable-stream"
:
"2.3.7"
,
"safe-buffer"
:
"5.1.2"
,
"sqlstring"
:
"2.3.1"
}
},
"negotiator"
:
{
"version"
:
"0.6.2"
,
"resolved"
:
"https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz"
,
...
...
@@ -613,6 +639,11 @@
"integrity"
:
"sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY="
,
"dev"
:
true
},
"process-nextick-args"
:
{
"version"
:
"2.0.1"
,
"resolved"
:
"https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz"
,
"integrity"
:
"sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
},
"proxy-addr"
:
{
"version"
:
"2.0.6"
,
"resolved"
:
"https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz"
,
...
...
@@ -654,6 +685,20 @@
"pify"
:
"^3.0.0"
}
},
"readable-stream"
:
{
"version"
:
"2.3.7"
,
"resolved"
:
"https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz"
,
"integrity"
:
"sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw=="
,
"requires"
:
{
"core-util-is"
:
"~1.0.0"
,
"inherits"
:
"~2.0.3"
,
"isarray"
:
"~1.0.0"
,
"process-nextick-args"
:
"~2.0.0"
,
"safe-buffer"
:
"~5.1.1"
,
"string_decoder"
:
"~1.1.1"
,
"util-deprecate"
:
"~1.0.1"
}
},
"require-directory"
:
{
"version"
:
"2.1.1"
,
"resolved"
:
"https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz"
,
...
...
@@ -793,6 +838,11 @@
"integrity"
:
"sha512-U+MTEOO0AiDzxwFvoa4JVnMV6mZlJKk2sBLt90s7G0Gd0Mlknc7kxEn3nuDPNZRta7O2uy8oLcZLVT+4sqNZHQ=="
,
"dev"
:
true
},
"sqlstring"
:
{
"version"
:
"2.3.1"
,
"resolved"
:
"https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz"
,
"integrity"
:
"sha1-R1OT/56RR5rqYtyvDKPRSYOn+0A="
},
"statuses"
:
{
"version"
:
"1.5.0"
,
"resolved"
:
"https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz"
,
...
...
@@ -809,6 +859,14 @@
"strip-ansi"
:
"^5.1.0"
}
},
"string_decoder"
:
{
"version"
:
"1.1.1"
,
"resolved"
:
"https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz"
,
"integrity"
:
"sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg=="
,
"requires"
:
{
"safe-buffer"
:
"~5.1.0"
}
},
"strip-ansi"
:
{
"version"
:
"5.2.0"
,
"resolved"
:
"https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz"
,
...
...
@@ -866,6 +924,11 @@
"resolved"
:
"https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz"
,
"integrity"
:
"sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
},
"util-deprecate"
:
{
"version"
:
"1.0.2"
,
"resolved"
:
"https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz"
,
"integrity"
:
"sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
},
"utils-merge"
:
{
"version"
:
"1.0.1"
,
"resolved"
:
"https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz"
,
...
...
package.json
View file @
36b0af9
...
...
@@ -9,7 +9,8 @@
"dependencies"
:
{
"body-parser"
:
"^1.19.0"
,
"express"
:
"4.17.1"
,
"http-proxy-middleware"
:
"^1.0.6"
"http-proxy-middleware"
:
"^1.0.6"
,
"mysql"
:
"^2.18.1"
},
"devDependencies"
:
{
"concurrently"
:
"^5.3.0"
...
...
server.js
View file @
36b0af9
const
fs
=
require
(
'fs'
);
const
express
=
require
(
'express'
);
const
bodyparser
=
require
(
"body-parser"
);
const
app
=
express
();
...
...
@@ -6,31 +7,27 @@ const port = process.env.process || 5000;
app
.
use
(
bodyparser
.
json
());
app
.
use
(
bodyparser
.
urlencoded
({
extended
:
true
}));
const
data
=
fs
.
readFileSync
(
'./database.json'
);
const
conf
=
JSON
.
parse
(
data
);
const
mysql
=
require
(
'mysql'
);
const
connection
=
mysql
.
createConnection
({
host
:
conf
.
host
,
user
:
conf
.
user
,
password
:
conf
.
password
,
port
:
conf
.
port
,
database
:
conf
.
database
});
connection
.
connect
();
app
.
get
(
'/api/students'
,
(
req
,
res
)
=>
{
res
.
send
([
{
'st_Code'
:
6666
,
'st_Name'
:
'육현진'
,
'st_Id'
:
2018102210
,
'st_Major'
:
'컴퓨터공학과'
,
'st_Midscore'
:
100
,
'st_Finalscore'
:
100
,
'st_Assignscore'
:
100
,
'st_Attendscore'
:
100
,
'st_Score'
:
'A+'
},
{
'st_Code'
:
1111
,
'st_Name'
:
'김창동'
,
'st_Id'
:
2020021120
,
'st_Major'
:
'컴퓨터공학과'
,
'st_Midscore'
:
79
,
'st_Finalscore'
:
85
,
'st_Assignscore'
:
100
,
'st_Attendscore'
:
90
,
'st_Score'
:
'A0'
}
]);
connection
.
query
(
"SELECT * FROM dbproject.Students"
,
(
err
,
rows
,
fields
)
=>
{
res
.
send
(
rows
);
}
);
});
app
.
listen
(
port
,
()
=>
console
.
log
(
`Listening on port
${
port
}
`
));
\ No newline at end of file
...
...
Please
register
or
login
to post a comment