From d271fc2d2c05e85463426924186cb6348401bceb Mon Sep 17 00:00:00 2001 From: Govind Kumar <42794725+govindk11@users.noreply.github.com> Date: Tue, 15 Sep 2020 18:09:32 +0530 Subject: [PATCH] Removed Deprication Warning --- RESTful Routing/RESTfulBlogApp/app.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/RESTful Routing/RESTfulBlogApp/app.js b/RESTful Routing/RESTfulBlogApp/app.js index daf0ccbc..02fb0bee 100644 --- a/RESTful Routing/RESTfulBlogApp/app.js +++ b/RESTful Routing/RESTfulBlogApp/app.js @@ -6,7 +6,11 @@ express = require("express"), app = express(); // APP CONFIG -mongoose.connect("mongodb://localhost/restful_blog_app"); +mongoose.connect('mongodb://localhost:27017/restful_blog_app', { + useNewUrlParser: true, + useUnifiedTopology: true, + useFindAndModify : false +}) app.set("view engine", "ejs"); app.use(express.static("public")); app.use(bodyParser.urlencoded({extended: true})); @@ -48,6 +52,7 @@ app.get("/blogs/new", function(req, res){ app.post("/blogs", function(req, res){ // create blog console.log(req.body); + req.body.blog.body= req.sanitize(req.body.blog.body); console.log("===========") console.log(req.body); Blog.create(req.body.blog, function(err, newBlog){