I have figured this out. Posting answer hoping it would help others.
var jsforce = require('jsforce');
var conn = new jsforce.Connection({
// you can change loginUrl to connect to sandbox or prerelease env.
loginUrl : 'https://test.salesforce.com'
});
var _request = {
url: '/services/data/v45.0/limits/recordCount?sObjects=Account,User',
method: 'get',
body: '',
headers : {
"Content-Type" : "application/json"
}
};
conn.login('username', 'pwd', function(err, userInfo) {
if (err) { return console.error(err); }
// Now you can get the access token and instance URL information.
// Save them to establish connection next time.
console.log(conn.accessToken);
console.log(conn.instanceUrl);
// logged in user property
console.log("User ID: " + userInfo.id);
console.log("Org ID: " + userInfo.organizationId);
// var records = [];
// conn.query("SELECT Id, Name FROM Account", function(err, result) {
// if (err) { return console.error(err); }
// console.log("total : " + result.totalSize);
// console.log("fetched : " + result.records.length);
// });
conn.request(_request, function(err, resp) {
console.log(resp);
});
});