I have a mapping
"balances": {
"1": "1000",
"2": "2000",
"3": "3000",
}
How do return 0 if the account number cant be found?
my code so far is
app.get('/GetBalanceByAddress/:id', function (req, res) {
res.end(JSON.stringify(balances.balances[req.params.id], null, 4));
});
for example, right now /GetBalance/1 returns 1000
/GetBalance/2 returns 2000
/GetBalance/3 returns 3000
and /GetBalance/4 returns nothing.
How do i get /GetBalance/(AnyNonExistentAddress) to return 0?