양효빈

fdzz

...@@ -114,3 +114,8 @@ dist ...@@ -114,3 +114,8 @@ dist
114 .yarn/build-state.yml 114 .yarn/build-state.yml
115 .yarn/install-state.gz 115 .yarn/install-state.gz
116 .pnp.* 116 .pnp.*
117 +
118 +
119 +package-lock.json
120 +# db
121 +lib.db.js
...\ No newline at end of file ...\ No newline at end of file
......
1 -<!DOCTYPE html>
2 -<html>
3 - <head>
4 - <title>HealthProtectorHome</title>
5 - <meta charset="utf-8" />
6 - </head>
7 - <body>
8 - <h1><a href="home.html">HealthProtector</a></h1>
9 - <ol>
10 - <li><a href="1.html">칼로리 계산</a></li>
11 - <li><a href="2.html">음식별 영양정보</a></li>
12 - </ol>
13 - <h2>음식별 영양정보</h2>
14 - <p>개개인의 신체 정보에 따라 일일 권장 섭취량을 알려주고, 좋아하는 음식을 검색하면 영양정보를 알려주는 사이트 입니다.</p>
15 - </body>
16 -</html>
1 -<!DOCTYPE html>
2 -<html>
3 - <head>
4 - <title>HealthProtectorHome</title>
5 - <meta charset="utf-8" />
6 - </head>
7 - <body>
8 - <h1><a href="home.html">HealthProtector</a></h1>
9 - <ol>
10 - <li><a href="1.html">칼로리 계산</a></li>
11 - <li><a href="2.html">음식별 영양정보</a></li>
12 - </ol>
13 - <h2>칼로리 계산</h2>
14 - <form action="./3.html">
15 - 성별 :<br />
16 - <select name="sex">
17 - <option value="man">남자</option>
18 - <option value="woman">여자</option></select
19 - ><br />
20 - 키(cm) : <br />
21 - <input type="text" name="height" /><br />
22 - 몸무게(kg) : <br /><input type="text" name="weight" /><br />
23 - 활동량 :<br />
24 - <select name="activity">
25 - <option value="low">가벼운 활동(주로 앉아서 생활)</option>
26 - <option value="mid">중등 활동(주로 서서 일하거나 생활)</option>
27 - <option value="high">많은 활동(건설, 농업 등 노동이 많은 일)</option>
28 - <option value="veryHigh">매우 많은 활동(운동선수)</option></select
29 - ><br />
30 - <input type="submit" value="계산하기" />
31 - </form>
32 - 일일 권장 섭취량 :
33 - </body>
34 -</html>
This diff could not be displayed because it is too large.
1 -<!DOCTYPE html>
2 -<html>
3 - <head>
4 - <title>HealthProtectorHome</title>
5 - <meta charset="utf-8" />
6 - </head>
7 - <body>
8 - <h1><a href="home.html">HealthProtector</a></h1>
9 - <ol>
10 - <li><a href="1.html">칼로리 계산</a></li>
11 - <li><a href="2.html">음식별 영양정보</a></li>
12 - </ol>
13 - <h2>소개</h2>
14 - <p>개개인의 신체 정보에 따라 일일 권장 섭취량을 알려주고, 좋아하는 음식을 검색하면 영양정보를 알려주는 사이트 입니다.</p>
15 - </body>
16 -</html>
1 +// db.js가 외부에 노출될 수 있으므로 따로 템플릿을 만들어 버전관리 시스템에는 이 파일을 올린다.
2 +var mysql = require('mysql');
3 +var db = mysql.createConnection({
4 + host: "",
5 + user: "",
6 + password: "",
7 + database: "",
8 +});
9 +db.connect();
10 +module.exports = db;
...\ No newline at end of file ...\ No newline at end of file
1 +var mysql = require('mysql');
2 +var db = mysql.createConnection({
3 + host: "localhost",
4 + user: "root",
5 + password: "kdj0630",
6 + database: "food",
7 +});
8 +db.connect();
9 +module.exports = db;
...\ No newline at end of file ...\ No newline at end of file
File mode changed
...@@ -10,6 +10,7 @@ module.exports = { ...@@ -10,6 +10,7 @@ module.exports = {
10 <meta charset="utf-8" /> 10 <meta charset="utf-8" />
11 </head> 11 </head>
12 <body> 12 <body>
13 +<<<<<<< HEAD
13 14
14 <style> 15 <style>
15 @import url('https://fonts.googleapis.com/css2?family=Jua&family=Noto+Sans+KR&display=swap'); 16 @import url('https://fonts.googleapis.com/css2?family=Jua&family=Noto+Sans+KR&display=swap');
...@@ -43,6 +44,13 @@ module.exports = { ...@@ -43,6 +44,13 @@ module.exports = {
43 <h4 style="font-family: 'Jua', sans-serif;"><font color="gray">음식별 식품 영양정보에 대해 알려드립니다!</h4> 44 <h4 style="font-family: 'Jua', sans-serif;"><font color="gray">음식별 식품 영양정보에 대해 알려드립니다!</h4>
44 </div> 45 </div>
45 <br><br><br><br><br> 46 <br><br><br><br><br>
47 +=======
48 + <h1><a href="/">HealthProtector</a></h1>
49 + <ol>
50 + <li><a href="/countKcal">칼로리 계산</a></li>
51 + <li><a href="/foodInfo">음식별 영양정보</a></li>
52 + </ol>
53 +>>>>>>> 1f4c622c1f957db4e7fadc6a311608a77210ef1f
46 ${body} 54 ${body}
47 55
48 <div style= width:100%;font-size:10px;position:fixed;bottom:0;float:left;padding:0px;background-color:#0B610B;> 56 <div style= width:100%;font-size:10px;position:fixed;bottom:0;float:left;padding:0px;background-color:#0B610B;>
...@@ -52,5 +60,41 @@ module.exports = { ...@@ -52,5 +60,41 @@ module.exports = {
52 </html> 60 </html>
53 61
54 ` 62 `
63 + },
64 + foodTable : function(foodInfo, list, num){
65 + var tag = '';
66 + tag += `<table`;
67 + tag += `
68 + <tr>
69 + <td>선택</td>
70 + <td>이름</td>
71 + <td>종류</td>
72 + <td>지역/제조사</td>
73 + <td>1회 제공량(g)</td>
74 + <td>칼로리(kcal)</td>
75 + <td>단백질(g)</td>
76 + <td>지방(g)</td>
77 + <td>탄수화물(g)</td>
78 + <td>나트륨(mg)</td>
79 + </tr>
80 + `
81 + for(var i =0; i < num; i++ ){
82 + tag += `
83 + <tr>
84 + <td><input type="checkbox" name="choose" value="${foodInfo[list[i]].id}"></td>
85 + <td>${foodInfo[list[i]].name}</td>
86 + <td>${foodInfo[list[i]].type}</td>
87 + <td>${foodInfo[list[i]].company}</td>
88 + <td>${foodInfo[list[i]].servingSize}</td>
89 + <td>${foodInfo[list[i]].kcal}</td>
90 + <td>${foodInfo[list[i]].protein}</td>
91 + <td>${foodInfo[list[i]].fat}</td>
92 + <td>${foodInfo[list[i]].carbohydrate}</td>
93 + <td>${foodInfo[list[i]].natrium}</td>
94 + </tr>
95 + `
96 + }
97 + tag+= `</table>`;
98 + return tag;
55 } 99 }
56 } 100 }
...\ No newline at end of file ...\ No newline at end of file
......
This diff is collapsed. Click to expand it.
1 +var fs = require("fs");
2 +fs.readFile("sample.txt", "utf8", function (err, data) {
3 + console.log(data);
4 +});
1 +var M = {
2 + v: "v",
3 + f: function () {
4 + console.log(this.v);
5 + },
6 +};
7 +
8 +module.exports = M; //M을 바깥에서 사용할 수 있도록 exports한다.
1 +// var M = {
2 +// v: "v",
3 +// f: function () {
4 +// console.log(this.v);
5 +// },
6 +// };
7 +
8 +var part = require("./mpart.js"); //동일한 파일에 속해있는 mpart.js의 모듈을 가져온다.
9 +//M.f();
10 +part.f();
1 +var mysql = require("mysql");
2 +var connection = mysql.createConnection({
3 + host: "localhost",
4 + user: "root",
5 + password: "kdj0630",
6 + database: "food",
7 +});
8 +
9 +connection.connect();
10 +
11 +connection.query("SELECT * FROM topic", function (error, results, fields) {
12 + if (error) {
13 + console.log(error);
14 + }
15 + console.log(results);
16 +});
17 +
18 +connection.end();
1 +var testFolder = "./data";
2 +var fs = require("fs");
3 +
4 +fs.readdir(testFolder, function (error, filelist) {
5 + console.log(filelist);
6 +});
1 +Read from a file specified by fd and write to an array of ArrayBufferViews using readv().
2 +position is the offset from the beginning of the file from where data should be read. If typeof position !== 'number', the data will be read from the current position.
3 +The callback will be given three arguments: err, bytesRead, and buffers. bytesRead is how many bytes were read from the file.
4 +If this method is invoked as its util.promisify()ed version, it returns a Promise for an Object with bytesRead and buffers properties.
...\ No newline at end of file ...\ No newline at end of file
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
7 }, 7 },
8 "author": "", 8 "author": "",
9 "license": "ISC", 9 "license": "ISC",
10 +<<<<<<< HEAD
10 "directories": { 11 "directories": {
11 "lib": "lib" 12 "lib": "lib"
12 }, 13 },
...@@ -16,6 +17,10 @@ ...@@ -16,6 +17,10 @@
16 }, 17 },
17 "description": "", 18 "description": "",
18 "dependencies": { 19 "dependencies": {
20 +=======
21 + "dependencies": {
22 + "mysql": "^2.18.1",
23 +>>>>>>> 1f4c622c1f957db4e7fadc6a311608a77210ef1f
19 "react": "^17.0.1", 24 "react": "^17.0.1",
20 "react-dom": "^17.0.1" 25 "react-dom": "^17.0.1"
21 } 26 }
......
1 +const { compileFunction } = require("vm");
2 +
3 +/*
4 +function a(){
5 + console.log('A');
6 +}
7 +*/
8 +
9 +//java에선 함수가 값이 될 수 있다.
10 +var a = function () {
11 + console.log("A");
12 +};
13 +
14 +function slowfunc(callback) {
15 + callback();
16 +}
17 +
18 +slowfunc(a);
1 +<form action="http://localhost:3000/process_create" method="post">
2 + <p><input type="text" name="title" /></p>
3 + <p>
4 + <textarea name="description" id="" cols="30" rows="10"></textarea>
5 + </p>
6 + <p>
7 + <input type="submit" />
8 + </p>
9 +</form>
1 +var members = ['egoing', 'k8805', 'hoya'];
2 +console.log(members[1]); // k8805
3 +var i = 0;
4 +while(i < members.length){
5 + console.log('array loop', members[i]);
6 + i = i + 1;
7 +}
8 +
9 +var roles = {
10 + 'programmer':'egoing',
11 + 'designer' : 'k8805',
12 + 'manager' : 'hoya'
13 +}
14 +console.log(roles.designer); //k8805
15 +console.log(roles['designer']); //k8805
16 +
17 +for(var n in roles){
18 + console.log('object => ', n, 'value => ', roles[n]);
19 +}
...\ No newline at end of file ...\ No newline at end of file
1 +var f = function(){
2 + console.log(1+1);
3 + console.log(1+2);
4 + }
5 +var a = [f];
6 +a[0]();
7 +
8 +var o = {
9 + func:f
10 +}
11 +o.func();
...\ No newline at end of file ...\ No newline at end of file
1 +var q = {
2 + v1:'v1',
3 + v2:'v2',
4 + f1:function (){
5 + console.log(this.v1);
6 + },
7 + f2:function(){
8 + console.log(this.v2);
9 + }
10 + }
11 +
12 + q.f1();
13 + q.f2();
...\ No newline at end of file ...\ No newline at end of file
1 +B
...\ No newline at end of file ...\ No newline at end of file
1 +var fs = require("fs");
2 +
3 +/*
4 + //synchronous 동기식(순서대로) - A B C 출력
5 +//readFileSync
6 +console.log("A");
7 +var result = fs.readFileSync("syntax/sample.txt", "utf8");
8 +console.log(result);
9 +console.log("C");
10 +
11 +*/
12 +
13 +//asynchronous 비동기식(성능이 좋음) - A C B 출력
14 +console.log("A");
15 +fs.readFile("syntax/sample.txt", "utf8", function (err, result) {
16 + console.log(result);
17 +});
18 +console.log("C");
1 -하루 권장 칼로리 = 표준체중(kg) * 활동지수
2 -표준체중 = 키(m)*키(m)*a (a = 21(여성), 22(남성))
3 -활동지수 =
4 -{
5 - - 앉아서 주로 생활하거나 매일 가벼운 움직임만 하며 활동량이 적은 경우 : 25
6 - - 규칙적인 생활로 보통의 활동량을 가진 경우, 30~35
7 - - 육체노동 등 평소 신체 활동량이 많은 경우, 40
8 -
9 -
10 -}
...\ No newline at end of file ...\ No newline at end of file
1 +- 표준체중 = 키(m)*키(m)*a (a = 21(여성), 22(남성))
2 +- BMR(기초 대사량)
3 + 남자 = 66.5 + 13.75*weight + 5.003*height - 6.755*age
4 + 여자 = 655. + 9.563*weight + 1.85*height - 4.676*age
5 +- TDEE(현재 체중 유지를 위한 열량)
...\ No newline at end of file ...\ No newline at end of file
......
1 +<음식 영양정보 검색>
2 +- 공백, 특수문자 처리
3 +- 오름차순, 내림차순 처리(mysql활용)
4 +- 음식 먹은 것 추가해서 총 영양 정보 알려주기
5 +<근처 헬스장 찾아주기>
...\ No newline at end of file ...\ No newline at end of file
1 +http://openapi.foodsafetykorea.go.kr/api/keyId/serviceId/dataType/startIdx/endIdx
2 +
3 +http://openapi.foodsafetykorea.go.kr/api/fab2561d1a8746db8276/I2790/json/1/5
4 +
5 +http://openapi.foodsafetykorea.go.kr/api/sample/I2790/xml/1/5
...\ No newline at end of file ...\ No newline at end of file