육현진

create db table & node.js db connection

1 # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 1 # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 2
3 +#database
4 +/database.json
5 +
3 # dependencies 6 # dependencies
4 /node_modules 7 /node_modules
5 /.pnp 8 /.pnp
......
1 -[{"C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\index.js":"1","C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\App.js":"2","C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\reportWebVitals.js":"3","C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\components\\Student.js":"4"},{"size":500,"mtime":499162500000,"results":"5","hashOfConfig":"6"},{"size":3449,"mtime":1607370599142,"results":"7","hashOfConfig":"6"},{"size":362,"mtime":499162500000,"results":"8","hashOfConfig":"6"},{"size":2433,"mtime":1607363898200,"results":"9","hashOfConfig":"6"},{"filePath":"10","messages":"11","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"12"},"15hdric",{"filePath":"13","messages":"14","errorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":null},{"filePath":"15","messages":"16","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"12"},{"filePath":"17","messages":"18","errorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":"19","usedDeprecatedRules":"12"},"C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\index.js",[],["20","21"],"C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\App.js",["22","23","24"],"C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\reportWebVitals.js",[],"C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\components\\Student.js",["25","26","27"],"import React from 'react';\r\nimport TableRow from '@material-ui/core/TableRow';\r\nimport TableCell from '@material-ui/core/TableCell';\r\n\r\nclass Student extends React.Component{\r\n render(){\r\n return(\r\n <TableRow>\r\n <TableCell> {this.props.st_Code} </TableCell>\r\n <TableCell> {this.props.st_Name} </TableCell>\r\n <TableCell> {this.props.st_Id} </TableCell>\r\n <TableCell> {this.props.st_Major} </TableCell>\r\n <TableCell> {this.props.st_Midscore} </TableCell>\r\n <TableCell> {this.props.st_Finalscore} </TableCell>\r\n <TableCell> {this.props.st_Assignscore} </TableCell>\r\n <TableCell> {this.props.st_Attendscore} </TableCell>\r\n <TableCell> {this.props.st_Score} </TableCell>\r\n\r\n </TableRow>\r\n \r\n /*<div>\r\n \r\n <Searchscores st_Midscore={this.props.st_Midscore} \r\n st_Finalscore = {this.props.st_Finalscore}\r\n st_Assignscore = {this.props.st_Assignscore}\r\n st_Attendscore = {this.props.st_Attendscore}/>\r\n\r\n <Searchscore st_Score={this.props.st_Score}/>\r\n\r\n <Searchothers st_Midscore={this.props.st_Midscore} \r\n st_Finalscore = {this.props.st_Finalscore}\r\n st_Assignscore = {this.props.st_Assignscore}\r\n st_Attendscore = {this.props.st_Attendscore}\r\n st_Score = {this.props.st_Score}/>\r\n\r\n </div>*/\r\n\r\n )\r\n }\r\n}\r\n\r\nclass Searchscores extends React.Component{\r\n render(){\r\n return(\r\n <div>\r\n\r\n <p>{this.props.st_Midscore}</p>\r\n <p>{this.props.st_Finalscore}</p>\r\n <p>{this.props.st_Assignscore}</p>\r\n <p>{this.props.st_Attendscore}</p>\r\n\r\n </div> \r\n )\r\n }\r\n}\r\n\r\n\r\nclass Searchscore extends React.Component{\r\n render(){\r\n return(\r\n <div>\r\n <p>{this.props.st_Score}</p>\r\n </div> \r\n )\r\n }\r\n}\r\n\r\nclass Searchothers extends React.Component{\r\n render(){\r\n return(\r\n <div>\r\n <p>{this.props.st_Midscore}</p>\r\n <p>{this.props.st_Finalscore}</p>\r\n <p>{this.props.st_Assignscore}</p>\r\n <p>{this.props.st_Attendscore}</p>\r\n <p>{this.props.st_Score}</p>\r\n </div> \r\n )\r\n }\r\n}\r\n\r\nexport default Student;",{"ruleId":"28","replacedBy":"29"},{"ruleId":"30","replacedBy":"31"},{"ruleId":"32","severity":1,"message":"33","line":1,"column":27,"nodeType":"34","messageId":"35","endLine":1,"endColumn":37},{"ruleId":"32","severity":1,"message":"36","line":11,"column":8,"nodeType":"34","messageId":"35","endLine":11,"endColumn":24},{"ruleId":"32","severity":1,"message":"37","line":28,"column":7,"nodeType":"34","messageId":"35","endLine":28,"endColumn":15},{"ruleId":"32","severity":1,"message":"38","line":42,"column":7,"nodeType":"34","messageId":"35","endLine":42,"endColumn":19},{"ruleId":"32","severity":1,"message":"39","line":58,"column":7,"nodeType":"34","messageId":"35","endLine":58,"endColumn":18},{"ruleId":"32","severity":1,"message":"40","line":68,"column":7,"nodeType":"34","messageId":"35","endLine":68,"endColumn":19},"no-native-reassign",["41"],"no-negated-in-lhs",["42"],"no-unused-vars","'components' is defined but never used.","Identifier","unusedVar","'curcularProgress' is defined but never used.","'students' is assigned a value but never used.","'Searchscores' is defined but never used.","'Searchscore' is defined but never used.","'Searchothers' is defined but never used.","no-global-assign","no-unsafe-negation"]
...\ No newline at end of file ...\ No newline at end of file
1 +[{"C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\index.js":"1","C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\App.js":"2","C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\reportWebVitals.js":"3","C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\components\\Student.js":"4"},{"size":500,"mtime":499162500000,"results":"5","hashOfConfig":"6"},{"size":3449,"mtime":1607370599142,"results":"7","hashOfConfig":"6"},{"size":362,"mtime":499162500000,"results":"8","hashOfConfig":"6"},{"size":2433,"mtime":1607363898200,"results":"9","hashOfConfig":"6"},{"filePath":"10","messages":"11","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"12"},"15hdric",{"filePath":"13","messages":"14","errorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":"15","usedDeprecatedRules":"12"},{"filePath":"16","messages":"17","errorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0,"usedDeprecatedRules":"12"},{"filePath":"18","messages":"19","errorCount":0,"warningCount":3,"fixableErrorCount":0,"fixableWarningCount":0,"source":"20","usedDeprecatedRules":"21"},"C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\index.js",[],["22","23"],"C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\App.js",["24","25","26"],"import React, {Component, components} from 'react';\nimport Student from './components/Student';\nimport './App.css';\nimport Paper from '@material-ui/core/Paper'\nimport Table from '@material-ui/core/Table'\nimport TableHead from '@material-ui/core/TableHead'\nimport TableBody from '@material-ui/core/TableBody'\nimport TableRow from '@material-ui/core/TableRow'\nimport TableCell from '@material-ui/core/TableCell'\nimport {withStyles} from '@material-ui/core/styles';\nimport curcularProgress from '@material-ui/core/CircularProgress';\nimport CircularProgress from '@material-ui/core/CircularProgress';\n\nconst styles = theme => ({\n root: {\n width: '100%',\n marginTop: theme.spacing.unit * 3,\n overflowX: \"auto\"\n },\n table: {\n minWidth:1000\n },\n progress:{\n margin: theme.spacing.unit * 2\n }\n})\n\nconst students = [\n {\n 'st_Code': 6666,\n 'st_Name': '육현진',\n 'st_Id': 2018102210,\n 'st_Major':'컴퓨터공학과',\n 'st_Midscore': 100,\n 'st_Finalscore': 100,\n 'st_Assignscore': 100,\n 'st_Attendscore': 100,\n 'st_Score':'A+'\n},\n{\n 'st_Code': 1111,\n 'st_Name': '김창동',\n 'st_Id': 2020021120,\n 'st_Major':'컴퓨터공학과',\n 'st_Midscore': 79,\n 'st_Finalscore': 85,\n 'st_Assignscore': 100,\n 'st_Attendscore': 90,\n 'st_Score':'A0'\n}]\n\nclass App extends Component{\n\n state = {\n students: \"\",\n completed: 0\n }\n\n componentDidMount() {\n this.timer= setInterval(this.progress,20);\n this.callApi()\n .then(res => this.setState({students: res}))\n .catch(err => console.log(err));\n }\n\n callApi=async()=>{\n const response = await fetch('/api/students');\n const body = await response.json();\n return body;\n }\n\n progress=() =>{\n const{completed}= this.state;\n this.setState({completed:completed >= 100 ?0:completed +1});\n }\n\n render(){\n\n const {classes}= this.props;\n\n return ( \n <Paper className={classes.root}>\n <Table className={classes.table}>\n\n <TableHead>\n <TableRow>\n <TableCell>코드번호</TableCell>\n <TableCell>이름</TableCell>\n <TableCell>학번</TableCell>\n <TableCell>전공</TableCell>\n <TableCell>중간</TableCell>\n <TableCell>기말</TableCell>\n <TableCell>과제</TableCell>\n <TableCell>출석</TableCell>\n <TableCell>학점</TableCell>\n </TableRow>\n </TableHead>\n \n <TableBody>\n {\n this.state.students ?\n this.state.students.map(c=>{\n return (\n <Student\n key={c.st_Code}\n st_Code={c.st_Code}\n st_Name={c.st_Name}\n st_Id={c.st_Id}\n st_Major={c.st_Major}\n st_Midscore={c.st_Midscore}\n st_Finalscore={c.st_Finalscore}\n st_Assignscore={c.st_Assignscore}\n st_Attendscore={c.st_Attendscore}\n st_Score={c.st_Score}\n />\n );\n }) : \n <TableRow>\n <TableCell colSpan=\"9\" allign=\"center\">\n <CircularProgress className={classes.progress} variant=\"determinate\" value={this.state.completed}/>\n </TableCell>\n </TableRow>\n } \n </TableBody>\n\n </Table>\n\n </Paper>\n\n );\n }\n}\n\nexport default withStyles(styles)(App);\n","C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\reportWebVitals.js",[],"C:\\Users\\sally\\Desktop\\3-1\\DBproject\\project\\client\\src\\components\\Student.js",["27","28","29"],"import React from 'react';\r\nimport TableRow from '@material-ui/core/TableRow';\r\nimport TableCell from '@material-ui/core/TableCell';\r\n\r\nclass Student extends React.Component{\r\n render(){\r\n return(\r\n <TableRow>\r\n <TableCell> {this.props.st_Code} </TableCell>\r\n <TableCell> {this.props.st_Name} </TableCell>\r\n <TableCell> {this.props.st_Id} </TableCell>\r\n <TableCell> {this.props.st_Major} </TableCell>\r\n <TableCell> {this.props.st_Midscore} </TableCell>\r\n <TableCell> {this.props.st_Finalscore} </TableCell>\r\n <TableCell> {this.props.st_Assignscore} </TableCell>\r\n <TableCell> {this.props.st_Attendscore} </TableCell>\r\n <TableCell> {this.props.st_Score} </TableCell>\r\n\r\n </TableRow>\r\n \r\n /*<div>\r\n \r\n <Searchscores st_Midscore={this.props.st_Midscore} \r\n st_Finalscore = {this.props.st_Finalscore}\r\n st_Assignscore = {this.props.st_Assignscore}\r\n st_Attendscore = {this.props.st_Attendscore}/>\r\n\r\n <Searchscore st_Score={this.props.st_Score}/>\r\n\r\n <Searchothers st_Midscore={this.props.st_Midscore} \r\n st_Finalscore = {this.props.st_Finalscore}\r\n st_Assignscore = {this.props.st_Assignscore}\r\n st_Attendscore = {this.props.st_Attendscore}\r\n st_Score = {this.props.st_Score}/>\r\n\r\n </div>*/\r\n\r\n )\r\n }\r\n}\r\n\r\nclass Searchscores extends React.Component{\r\n render(){\r\n return(\r\n <div>\r\n\r\n <p>{this.props.st_Midscore}</p>\r\n <p>{this.props.st_Finalscore}</p>\r\n <p>{this.props.st_Assignscore}</p>\r\n <p>{this.props.st_Attendscore}</p>\r\n\r\n </div> \r\n )\r\n }\r\n}\r\n\r\n\r\nclass Searchscore extends React.Component{\r\n render(){\r\n return(\r\n <div>\r\n <p>{this.props.st_Score}</p>\r\n </div> \r\n )\r\n }\r\n}\r\n\r\nclass Searchothers extends React.Component{\r\n render(){\r\n return(\r\n <div>\r\n <p>{this.props.st_Midscore}</p>\r\n <p>{this.props.st_Finalscore}</p>\r\n <p>{this.props.st_Assignscore}</p>\r\n <p>{this.props.st_Attendscore}</p>\r\n <p>{this.props.st_Score}</p>\r\n </div> \r\n )\r\n }\r\n}\r\n\r\nexport default Student;",["30","31"],{"ruleId":"32","replacedBy":"33"},{"ruleId":"34","replacedBy":"35"},{"ruleId":"36","severity":1,"message":"37","line":1,"column":27,"nodeType":"38","messageId":"39","endLine":1,"endColumn":37},{"ruleId":"36","severity":1,"message":"40","line":11,"column":8,"nodeType":"38","messageId":"39","endLine":11,"endColumn":24},{"ruleId":"36","severity":1,"message":"41","line":28,"column":7,"nodeType":"38","messageId":"39","endLine":28,"endColumn":15},{"ruleId":"36","severity":1,"message":"42","line":42,"column":7,"nodeType":"38","messageId":"39","endLine":42,"endColumn":19},{"ruleId":"36","severity":1,"message":"43","line":58,"column":7,"nodeType":"38","messageId":"39","endLine":58,"endColumn":18},{"ruleId":"36","severity":1,"message":"44","line":68,"column":7,"nodeType":"38","messageId":"39","endLine":68,"endColumn":19},{"ruleId":"32","replacedBy":"45"},{"ruleId":"34","replacedBy":"46"},"no-native-reassign",["47"],"no-negated-in-lhs",["48"],"no-unused-vars","'components' is defined but never used.","Identifier","unusedVar","'curcularProgress' is defined but never used.","'students' is assigned a value but never used.","'Searchscores' is defined but never used.","'Searchscore' is defined but never used.","'Searchothers' is defined but never used.",["47"],["48"],"no-global-assign","no-unsafe-negation"]
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -46,6 +46,11 @@ ...@@ -46,6 +46,11 @@
46 "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", 46 "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
47 "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" 47 "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
48 }, 48 },
49 + "bignumber.js": {
50 + "version": "9.0.0",
51 + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz",
52 + "integrity": "sha512-t/OYhhJ2SD+YGBQcjY8GzzDHEk9f3nerxjtfa6tlMXfe7frs/WozhvCNoGvpM0P3bNf3Gq5ZRMlGr5f3r4/N8A=="
53 + },
49 "body-parser": { 54 "body-parser": {
50 "version": "1.19.0", 55 "version": "1.19.0",
51 "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", 56 "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz",
...@@ -170,6 +175,11 @@ ...@@ -170,6 +175,11 @@
170 "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", 175 "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
171 "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" 176 "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
172 }, 177 },
178 + "core-util-is": {
179 + "version": "1.0.2",
180 + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
181 + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
182 + },
173 "date-fns": { 183 "date-fns": {
174 "version": "2.16.1", 184 "version": "2.16.1",
175 "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.16.1.tgz", 185 "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.16.1.tgz",
...@@ -453,6 +463,11 @@ ...@@ -453,6 +463,11 @@
453 "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", 463 "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
454 "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" 464 "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng=="
455 }, 465 },
466 + "isarray": {
467 + "version": "1.0.0",
468 + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
469 + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
470 + },
456 "json-parse-better-errors": { 471 "json-parse-better-errors": {
457 "version": "1.0.2", 472 "version": "1.0.2",
458 "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", 473 "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
...@@ -521,6 +536,17 @@ ...@@ -521,6 +536,17 @@
521 "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 536 "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
522 "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 537 "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
523 }, 538 },
539 + "mysql": {
540 + "version": "2.18.1",
541 + "resolved": "https://registry.npmjs.org/mysql/-/mysql-2.18.1.tgz",
542 + "integrity": "sha512-Bca+gk2YWmqp2Uf6k5NFEurwY/0td0cpebAucFpY/3jhrwrVGuxU2uQFCHjU19SJfje0yQvi+rVWdq78hR5lig==",
543 + "requires": {
544 + "bignumber.js": "9.0.0",
545 + "readable-stream": "2.3.7",
546 + "safe-buffer": "5.1.2",
547 + "sqlstring": "2.3.1"
548 + }
549 + },
524 "negotiator": { 550 "negotiator": {
525 "version": "0.6.2", 551 "version": "0.6.2",
526 "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", 552 "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz",
...@@ -613,6 +639,11 @@ ...@@ -613,6 +639,11 @@
613 "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", 639 "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=",
614 "dev": true 640 "dev": true
615 }, 641 },
642 + "process-nextick-args": {
643 + "version": "2.0.1",
644 + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
645 + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
646 + },
616 "proxy-addr": { 647 "proxy-addr": {
617 "version": "2.0.6", 648 "version": "2.0.6",
618 "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz", 649 "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.6.tgz",
...@@ -654,6 +685,20 @@ ...@@ -654,6 +685,20 @@
654 "pify": "^3.0.0" 685 "pify": "^3.0.0"
655 } 686 }
656 }, 687 },
688 + "readable-stream": {
689 + "version": "2.3.7",
690 + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
691 + "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
692 + "requires": {
693 + "core-util-is": "~1.0.0",
694 + "inherits": "~2.0.3",
695 + "isarray": "~1.0.0",
696 + "process-nextick-args": "~2.0.0",
697 + "safe-buffer": "~5.1.1",
698 + "string_decoder": "~1.1.1",
699 + "util-deprecate": "~1.0.1"
700 + }
701 + },
657 "require-directory": { 702 "require-directory": {
658 "version": "2.1.1", 703 "version": "2.1.1",
659 "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", 704 "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
...@@ -793,6 +838,11 @@ ...@@ -793,6 +838,11 @@
793 "integrity": "sha512-U+MTEOO0AiDzxwFvoa4JVnMV6mZlJKk2sBLt90s7G0Gd0Mlknc7kxEn3nuDPNZRta7O2uy8oLcZLVT+4sqNZHQ==", 838 "integrity": "sha512-U+MTEOO0AiDzxwFvoa4JVnMV6mZlJKk2sBLt90s7G0Gd0Mlknc7kxEn3nuDPNZRta7O2uy8oLcZLVT+4sqNZHQ==",
794 "dev": true 839 "dev": true
795 }, 840 },
841 + "sqlstring": {
842 + "version": "2.3.1",
843 + "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.1.tgz",
844 + "integrity": "sha1-R1OT/56RR5rqYtyvDKPRSYOn+0A="
845 + },
796 "statuses": { 846 "statuses": {
797 "version": "1.5.0", 847 "version": "1.5.0",
798 "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", 848 "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
...@@ -809,6 +859,14 @@ ...@@ -809,6 +859,14 @@
809 "strip-ansi": "^5.1.0" 859 "strip-ansi": "^5.1.0"
810 } 860 }
811 }, 861 },
862 + "string_decoder": {
863 + "version": "1.1.1",
864 + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
865 + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
866 + "requires": {
867 + "safe-buffer": "~5.1.0"
868 + }
869 + },
812 "strip-ansi": { 870 "strip-ansi": {
813 "version": "5.2.0", 871 "version": "5.2.0",
814 "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", 872 "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
...@@ -866,6 +924,11 @@ ...@@ -866,6 +924,11 @@
866 "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", 924 "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
867 "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" 925 "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
868 }, 926 },
927 + "util-deprecate": {
928 + "version": "1.0.2",
929 + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
930 + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
931 + },
869 "utils-merge": { 932 "utils-merge": {
870 "version": "1.0.1", 933 "version": "1.0.1",
871 "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", 934 "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
......
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
9 "dependencies": { 9 "dependencies": {
10 "body-parser": "^1.19.0", 10 "body-parser": "^1.19.0",
11 "express": "4.17.1", 11 "express": "4.17.1",
12 - "http-proxy-middleware": "^1.0.6" 12 + "http-proxy-middleware": "^1.0.6",
13 + "mysql": "^2.18.1"
13 }, 14 },
14 "devDependencies": { 15 "devDependencies": {
15 "concurrently": "^5.3.0" 16 "concurrently": "^5.3.0"
......
1 +const fs= require('fs');
1 const express=require('express'); 2 const express=require('express');
2 const bodyparser = require("body-parser"); 3 const bodyparser = require("body-parser");
3 const app = express(); 4 const app = express();
...@@ -6,31 +7,27 @@ const port = process.env.process || 5000; ...@@ -6,31 +7,27 @@ const port = process.env.process || 5000;
6 app.use(bodyparser.json()); 7 app.use(bodyparser.json());
7 app.use(bodyparser.urlencoded({ extended: true})); 8 app.use(bodyparser.urlencoded({ extended: true}));
8 9
10 +const data=fs.readFileSync('./database.json');
11 +const conf = JSON.parse(data);
12 +const mysql = require('mysql');
13 +
14 +const connection = mysql.createConnection({
15 + host: conf.host,
16 + user: conf.user,
17 + password: conf.password,
18 + port: conf.port,
19 + database: conf.database
20 +});
21 +
22 +connection.connect();
23 +
9 app.get('/api/students', (req, res)=>{ 24 app.get('/api/students', (req, res)=>{
10 - res.send([ 25 + connection.query(
11 - { 26 + "SELECT * FROM dbproject.Students",
12 - 'st_Code': 6666, 27 + (err,rows,fields)=>{
13 - 'st_Name': '육현진', 28 + res.send(rows);
14 - 'st_Id': 2018102210, 29 + }
15 - 'st_Major':'컴퓨터공학과', 30 + );
16 - 'st_Midscore': 100,
17 - 'st_Finalscore': 100,
18 - 'st_Assignscore': 100,
19 - 'st_Attendscore': 100,
20 - 'st_Score':'A+'
21 - },
22 - {
23 - 'st_Code': 1111,
24 - 'st_Name': '김창동',
25 - 'st_Id': 2020021120,
26 - 'st_Major':'컴퓨터공학과',
27 - 'st_Midscore': 79,
28 - 'st_Finalscore': 85,
29 - 'st_Assignscore': 100,
30 - 'st_Attendscore': 90,
31 - 'st_Score':'A0'
32 - }
33 - ]);
34 }); 31 });
35 32
36 app.listen(port, () => console.log(`Listening on port ${port}`)); 33 app.listen(port, () => console.log(`Listening on port ${port}`));
...\ No newline at end of file ...\ No newline at end of file
......