Showing
4 changed files
with
11 additions
and
21 deletions
... | @@ -3,3 +3,5 @@ | ... | @@ -3,3 +3,5 @@ |
3 | <input id ="logout" type="submit" value="Logout" class="btn btn-default" style=" width:100px;font-weight: bold; font-size: 18px; background-color: white;"> | 3 | <input id ="logout" type="submit" value="Logout" class="btn btn-default" style=" width:100px;font-weight: bold; font-size: 18px; background-color: white;"> |
4 | </form> | 4 | </form> |
5 | <br><br><br> | 5 | <br><br><br> |
6 | + | ||
7 | + | ... | ... |
... | @@ -38,6 +38,8 @@ var foodkind; | ... | @@ -38,6 +38,8 @@ var foodkind; |
38 | 38 | ||
39 | var ingr; | 39 | var ingr; |
40 | 40 | ||
41 | +var sID; | ||
42 | + | ||
41 | app.use(function(req, res, next) { | 43 | app.use(function(req, res, next) { |
42 | res.header("Access-Control-Allow-Origin", "*"); | 44 | res.header("Access-Control-Allow-Origin", "*"); |
43 | res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); | 45 | res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); |
... | @@ -67,18 +69,12 @@ app.get('/', function(request, response) { | ... | @@ -67,18 +69,12 @@ app.get('/', function(request, response) { |
67 | var user = db.get('users').find({ID:ID,password:password}).value(); | 69 | var user = db.get('users').find({ID:ID,password:password}).value(); |
68 | if(user){ | 70 | if(user){ |
69 | request.session.is_logined = true; | 71 | request.session.is_logined = true; |
70 | - | 72 | + request.session.ID=ID; |
73 | + sID=ID; | ||
71 | request.session.save(function(){ | 74 | request.session.save(function(){ |
72 | response.redirect('/InputPage') | 75 | response.redirect('/InputPage') |
73 | }); | 76 | }); |
74 | } | 77 | } |
75 | - | ||
76 | - | ||
77 | - | ||
78 | - | ||
79 | - | ||
80 | - | ||
81 | - | ||
82 | }); | 78 | }); |
83 | 79 | ||
84 | app.get('/signup', function(request, response) { | 80 | app.get('/signup', function(request, response) { |
... | @@ -146,8 +142,9 @@ app.get('/', function(request, response) { | ... | @@ -146,8 +142,9 @@ app.get('/', function(request, response) { |
146 | var ch='5ch' | 142 | var ch='5ch' |
147 | var jresult=JSON.parse(result); | 143 | var jresult=JSON.parse(result); |
148 | var cal = jresult.calories; | 144 | var cal = jresult.calories; |
149 | - | 145 | + var user = db.get('users').find({ID:sID}).value(); |
150 | - var ccc = container.L(`<h2>칼로리 : ${cal}kcal`,'','') | 146 | + var bmi = user.weight/(user.height*user.height/100/100); |
147 | + var ccc = container.L(`<h2>칼로리 : ${cal}kcal`,'',`<h2>bmi: ${bmi}</h2>`) | ||
151 | var html = template.HTML(title,ch,``,body,`#logout{ | 148 | var html = template.HTML(title,ch,``,body,`#logout{ |
152 | position:absolute; | 149 | position:absolute; |
153 | right: 20ch; | 150 | right: 20ch; | ... | ... |
1 | -{"cookie":{"originalMaxAge":null,"expires":null,"httpOnly":true,"path":"/"},"__lastAccess":1559828237372} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +{"cookie":{"originalMaxAge":null,"expires":null,"httpOnly":true,"path":"/"},"__lastAccess":1559831147957,"is_logined":true,"ID":"2"} | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment