title: Simple To-Do app just doesn't print to-dos
body: <p>I am building a simple To Do application Using node js, express, mongodb and ejs.</p>
  
  <p>My get Route renders the form and the post route handles post request on the form, they both work perfect, any time I insert a (todo) it gets saved and can be found in my Mongo compass.</p>
  
  <p>But it does not appear on the screen as Todo App should be. It only prints out usual bullets of (ul). I don't know what I am doing wrong, here is my code:</p>
  
  <pre><code>const express = require('express');
  const app = express();
  const port = 8080;
  const bodyParser = require('body-parser');
  const multer = require('multer');
  const upload = multer();
  const session = require('express-session');
  const cookieParser = require('cookie-parser');
  const mongoose = require('mongoose');
  mongoose.connect("mongodb://localhost/Todo-App", 
  {useUnifiedTopology:true,useNewUrlParser:true,useFindAndModify:false,useCreateIndex:true});
  app.set('view engine','ejs');
  
  app.use(bodyParser.json());
  app.use(bodyParser.urlencoded({ extended: true }));
  app.use(upload.array());
  app.use(cookieParser());
  app.use(session({secret:"secret"}));
  
  var todoschema = mongoose.Schema({
  item:String,
  });
  
  var Todo = mongoose.model("Todo",todoschema);
  
  app.get('/',(req,res)=&gt;{
  res.render('home.ejs',{Todo:Todo});
  });
  
  app.post('/',(req,res)=&gt;{
  var newTodo = new Todo({
      item:req.body.item,
  });
  newTodo.save((err,result)=&gt;{
      if(err){
          throw err;
      }
      else{
          res.redirect('/');
      }
  })
  })
  
  app.listen(8080,()=&gt;{
  console.log("App is running...")
  })
  </code></pre>
  
  <p>Here is my code in the ejs file</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en" dir="ltr"&gt;
  &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;title&gt;&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;h1&gt;My To-Do Application&lt;/h1&gt;
      &lt;form action="/" method="post"&gt;
          &lt;input type="text" name="item" placeholder="Enter Item"&gt;
          &lt;input type="submit" value="Add To List"&gt;
      &lt;/form&gt;
      &lt;%for(var i = 0; i &lt; Todo.length; i++){%&gt;
          &lt;li&gt; &lt;%=Todo[i]%&gt;&lt;/li&gt;
      &lt;%}%&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>