INNER CODE UNIT · JavaScript

collectVotesFromResult

dockersamples/example-voting-app · result/server.js:56

function collectVotesFromResult(result) {
  var votes = {a: 0, b: 0};

  result.rows.forEach(function (row) {
    votes[row.vote] = parseInt(row.count);
  });

  return votes;
}

app.use(cookieParser());
app.use(express.urlencoded());
app.use(express.static(__dirname + '/views'));

app.get('/', function (req, res) {
  res.sendFile(path.resolve(__dirname + '/views/index.html'));
});

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…