Skip to content

Commit

Permalink
major bug update / testing4
Browse files Browse the repository at this point in the history
  • Loading branch information
getlost01 committed Jul 27, 2022
1 parent 88147f7 commit ac06e89
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 86 deletions.
Binary file modified .DS_Store
Binary file not shown.
11 changes: 8 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ app.get('/show',(req,res,next)=>{
res.send(foodData);
})

app.get('/test',(req,res,next)=>{
res.render('mealshow');
})

//------ Calling from FrontEnd

import addItemsRoutes from './routes/fromFrontEnd/foodItemAdd.js';
Expand All @@ -39,15 +43,16 @@ app.use('/createUser', createUserItemRoutes);
import updatemealRoutes from './routes/patchAPI/createmealpatch.js';
app.use('/updatemeal', updatemealRoutes);

app.get('/updatemealplan',(req, res)=>{ res.render('createuser',{response:"patch"});})
app.post('/mealupdate',(req, res)=>{ res.render('createmeal',{response:"patch"});})

app.post('/updatemealplan',(req, res)=>{ res.render('createuser',{response:"patch"});})


//------- Algo

import algoRoutes from './routes/algo/optimizealgo.js';
app.use('/api/mealplan', algoRoutes);

app.get('/mealshow',(req, res)=>{ res.render('mealshow');})

// ------ APIs
import foodItemsRoutes from './routes/postAPI/foodItem.js';
app.use('/api/fooditems', foodItemsRoutes);
Expand Down
179 changes: 104 additions & 75 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions public/css/mealshow.css
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,18 @@
.assumptions div{
margin-bottom: 10px;
}
.butLink{
position: relative;
border: none;
outline: none;
margin: 0;
font-size: 14px;
margin-left: 3px;
background-color: transparent;
color: #2e63bd;
font-weight: 600;
padding: 0;
}

/* ---------- specific div section */

Expand Down
2 changes: 1 addition & 1 deletion routes/fromFrontEnd/createUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ router.post('/',async(req,res)=>{

const newUser = new User({ name: data.name , calorieRequirement: data.calories, mealPlan: obj});
const result = await newUser.save();
const myTimeout = setTimeout(()=>{res.redirect('/mealshow');}, 1000);
const myTimeout = setTimeout(()=>{res.render('mealshow');}, 1000);
});

});
Expand Down
3 changes: 0 additions & 3 deletions routes/patchAPI/createmealpatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ import express from "express";
import mealItems from'../../models/meal.js';
const router = express.Router();

router.get('/',async(req,res)=>{
res.render('createmeal',{response:"patch"});
})
router.post('/',async(req,res,next)=>{
try{
mealItems.find({}, function(err, mealItem) {
Expand Down
2 changes: 1 addition & 1 deletion views/additem.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<div><strong>Step-1: </strong>Select any 20 or 20+ food items of your choice.</div>
<div><strong>Step-2: </strong>Create your 5 meals by using these 20+ food items.</div>
<div><strong>Step-3: </strong>Select meals for your meal plan for 2 days.</div>
<div><strong>Note-1: </strong>After step-1 you will be forwarded by POST requests so DO NOT RELOAD the page.</div>
<div><strong>Note-1: </strong>After step-1 you will be forwarded by POST requests only, so DO NOT RELOAD any page.</div>
<div><strong>Note-2: </strong>Since this web app is a prototype so it can save data of only one user at the same time. </div>
</div>
<div class="modal-footer">
Expand Down
6 changes: 3 additions & 3 deletions views/mealshow.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
<div class="col-12 col-md-9 infoCon">
<h5 class="center">Other Features</h5>
<div class="assumptions">
<div> Update meal items <a href="/updatemeal"> click here</a> </div>
<div> Update meal plan <a href="/updatemealplan"> click here</a> </div>
<div> Create new meal plan from step 1 <a href="/"> click here</a> </div>
<div class="d-flex m-0"> Update meal items <form action="/mealupdate" method="post"> <input class="butLink" type="submit" value="Click here"> </form> </div>
<div class="d-flex m-0"> Update meal plan <form action="/updatemealplan" method="post"> <input class="butLink" type="submit" value="Click here"> </form> </div>
<div class="d-flex m-0"> Create new meal plan from step 1 <form action="/" method="get"> <input class="butLink" type="submit" value="Click here"> </form> </div>
</div>
</div>
</div>
Expand Down

1 comment on commit ac06e89

@vercel
Copy link

@vercel vercel bot commented on ac06e89 May 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.