Skip to content

Week3 Exercise 3 improvements #476

Description

@tomasvanrijsse

By week 3 the students are used to work with the promisified execQuery.

The exercise could be upgraded so there are less questions about the weirdness / old school approach.

const execQuery = util.promisify(connection.query.bind(connection));

async function getPopulationFromCountry(name, code) {
  // assuming that connection to the database is established and stored as conn
  return execQuery(
    `SELECT Population FROM `country` WHERE Name = '${name}' and code = '${code}'`
  );
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions