Form validations in express js with ejs template : I am new in nodejs and i am trying to validate my form using ejs template in express js.How can i do this ? Here is my code.

    app.post('/formsubmit', function(req, res) 
    	{
    			console.log(req.body);
    			var name =req.body.name;
    			var email=req.body.email;
    			var pwd =req.body.pwd;
    			var age =req.body.age;
    			
    			var con = mysql.createConnection
    				({
    					  host: "localhost",
    					  user: "root",
    					  password: "",
    					  database: "demos"
    				});
    
    			con.connect(function(err) {
    			if (err) throw err;
    			  console.log("Connected!");
    			  var sql = "INSERT INTO student (name, email,age) VALUES ('"+name+"','"+email+"','"+age+"')";
    			  con.query(sql, function (err, result) 
    			  	{
    			    	if (err) throw err;
    			   		 console.log("1 record inserted");
    			  });
    			});				
    
    		//console.log(record);
    			res.send('Record Inserted Successfully');
    
    }); 