CRUD operation in Node, Express Js and Mongoose | Node Js CRUD tutorial

In most of the applications we do the same thing and that CRUD (Create, Read, Update and Delete). Today we are going to do the same but in Node Js where we are using MongoDB as a database.                    Download Code

If you wanted to start with Node Js believe me this article will make you life very easy in Node Js & Mongo DB.

Before starting I believe you installed Node Js, NPM, Express and MongoDB.

Here is the video where I have discussed the below functionality.

The below link will help you for creating a Node Js App. ...  Read More

Share This:

Send message on redirect in node js | redirect with message node js | Flash message in node js

Some time we need to print a message after the redirection of page.
Like when you delete a post and will show “Post deleted successfully!” after reloading or redirecting the page.
I’m going to explain how we can redirect to another page in node js along with message.
First you need to install  express-session using below command if you have not installed:

Now you need to install req-flash using below command. It flash the message but this library is dependent on session.

Now in app.js include following:

If you are using express js might be you don’t need to put this line because this is already there.

Now you need to use session if you have not used it in app.js yet:

Now use flash in app.js file:

Now you can put your message in following way :

and you can achieve the message by following code.

so you can render your messages to view like this

Now on view you can print the message like :

Here I’m using ejs template engine. ...  Read More

Share This: