김용재

db로 bmi 나타냈다

......@@ -3,3 +3,5 @@
<input id ="logout" type="submit" value="Logout" class="btn btn-default" style=" width:100px;font-weight: bold; font-size: 18px; background-color: white;">
</form>
<br><br><br>
......
{
"users": [
{
"ID": "1",
"password": "1",
"age": "1",
"gender": "male",
"height": "1",
"weight": "1"
}
]
"users": []
}
\ No newline at end of file
......
......@@ -38,6 +38,8 @@ var foodkind;
var ingr;
var sID;
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
......@@ -67,18 +69,12 @@ app.get('/', function(request, response) {
var user = db.get('users').find({ID:ID,password:password}).value();
if(user){
request.session.is_logined = true;
request.session.ID=ID;
sID=ID;
request.session.save(function(){
response.redirect('/InputPage')
});
}
});
app.get('/signup', function(request, response) {
......@@ -146,8 +142,9 @@ app.get('/', function(request, response) {
var ch='5ch'
var jresult=JSON.parse(result);
var cal = jresult.calories;
var ccc = container.L(`<h2>칼로리 : ${cal}kcal`,'','')
var user = db.get('users').find({ID:sID}).value();
var bmi = user.weight/(user.height*user.height/100/100);
var ccc = container.L(`<h2>칼로리 : ${cal}kcal`,'',`<h2>bmi: ${bmi}</h2>`)
var html = template.HTML(title,ch,``,body,`#logout{
position:absolute;
right: 20ch;
......
{"cookie":{"originalMaxAge":null,"expires":null,"httpOnly":true,"path":"/"},"__lastAccess":1559828237372}
\ No newline at end of file
{"cookie":{"originalMaxAge":null,"expires":null,"httpOnly":true,"path":"/"},"__lastAccess":1559831147957,"is_logined":true,"ID":"2"}
\ No newline at end of file
......