title: res.render throwing error Node.JS
body: <p>I've been trying to make this blog, and when it comes to rendering a page it throws, "Res.Render is not a function..."</p>
  
  <pre><code>    let express = require("express"),
      app = express(),
      bodyParser = require("body-parser"),
      methodOV = require("method-override"),
      mongoose = require("mongoose"),
      passport = require("passport"),
      pL = require("passport-local"),
      pLM = require("passport-local-mongoose"),
      User = require("./user.js");
  
  mongoose.connect("mongodb://localhost/max");
  
  let maxBlog = new mongoose.Schema({
      title: String,
      author: String,
      content: String
  });
  
  let Blog = mongoose.model('Blog', maxBlog);
  
  app.use(express.static("public"));
  
  app.use(bodyParser.urlencoded({ extended: false }))
  
  app.use(bodyParser.json());
  
  app.use(methodOV("_method"));
  
  app.set('view engine', 'ejs');
  
  //AUTH
  
  app.use(passport.initialize());
  app.use(passport.session());
  
  passport.use(new pL(User.authenticate()));
  passport.serializeUser(User.serializeUser());
  passport.deserializeUser(User.deserializeUser());
  
  app.post("/register", (req, res) =&gt;{
      User.register(new User({username: req.body.username}), req.body.password, function(err, user){
          if(err){
              console.log(err);
              return res.render('register');
          }
          passport.authenticate("local")(req, res, function(){
             res.redirect("/secret");
          });
      });
  });
  
  // LOGIN ROUTES
  app.get("/login", (req, res) =&gt;{
     res.render("login"); 
  });
  //login logic
  app.post("/login", passport.authenticate("local", {
      successRedirect: "/secret",
      failureRedirect: "/login"
  }) ,(req, res) =&gt;{
  });
  
  app.get("/logout", (req, res) =&gt; {
      req.logout();
      res.redirect("/");
  });
  
  
  const isLoggedIn = (req, res, next) =&gt;{
      if(req.isAuthenticated()){
          return next();
      } else {
        res.redirect("/login");
      }
  };
  
  //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  
  app.get("/", (req,res) =&gt; {
      res.redirect("/home");
  });
  
  app.get("/home", (req,res) =&gt; {
      res.render("index");
  });
  
  app.get("/blog", (req,res) =&gt; {
      Blog.find({},(err,res) =&gt; {
          if (err){
              res.send("An unexpected error occured. Please try again later.");
          } else {
              res.render("blog",{blogs:res});
          }
      });
  });
  
  app.post("/blog",isLoggedIn,(req,res) =&gt; {
      Blog.create({
          title: req.body.t,
          author: req.body.a,
          content: req.body.c
      }), (err,create) =&gt; {
          if (err){
              res.send("There was an error. Try again later.");
          } else {
              res.render("blogs");
          }
      };
  });
  
  app.get("/blog:id",(req,res) =&gt; {
      Blog.findById(req.params.id,(err,find) =&gt; {
          if (err){
              res.send("An error occured. Please try again later.");
          } else {
              res.render("show",{blog:find});
          }
      });
  });
  
  app.put("/blogs:id",isLoggedIn,(req,res) =&gt; {
      Blog.findByIdAndUpdate(req.params.id,({
          content: req.body.c,
          author: req.body.a
      }),(err,update) =&gt; {
          if (err){
              res.send("An error occured. Please try again later.");
          } else {
              res.redirect("/blogs"+req.params.id);
          }
      });
  });
  
  app.listen(8080);
  </code></pre>
  
  <p>Please help! Thank you, Ben This has been bothering for me for a lot of time. It is very weird and all solutions have not worked. I have tried a lot of things and nothing has worked, unfortunately. Thank you so much.</p>