JavaScript export vs module.exports in NodeJS

Viewed 1415

Can somebody help me understand the differences between javascript class/function export and module.exports in node JS and why there are two ways to export javascript attributes and functions and when to use which export. Also is it possible to use both the exports together?

export function getUsers() {
    return users
}

VS

module.exports = {
  getUsers: function () {
    return users
  }
}
0 Answers
Related