How to get yesterday date in node.js backend?

I would take a look at moment.js if you are interested in doing calculations with dates, there are many issues you can run into trying to do it manually or even with the built in Date objects in JavaScript/node.js such as leap years and daylight savings time issues.

http://momentjs.com/

For example:

var moment = require('moment');
var yesterday = moment().subtract(1, 'days');
console.log(yesterday.format());

Try this:

var d = new Date(); // Today!
d.setDate(d.getDate() - 1); // Yesterday!